Waait. I didn't check but I'm not so sure it's supposed to work like that - I wonder why you had access to ___result_voidstar there at all.
Please allocate such a test structure *locally on the stack* within your struct-test procedure, and then set ___result to it. I.e., by value and not by pointer passing. Then paste here again.
2013/8/19 Chris Mueller ruunsmail@gmail.com
On 19.08.2013 12:16, Mikael wrote:
So in your past test with a pointered type, you did see the proper behavior. And here comes what applies to the current test:
In the case of the |struct|, |union| and |type| types, the default function reclaims the copy on the C heap referenced by the internal pointer (when using a C++ compiler this is done using ‘delete (type*)internal-pointer’, which calls the destructor of type if it is a class) and returns ‘___FIX(___NO_ERR)’.
Can you paste your full test code here?
Of course :)
;; struct definition (c-declare "struct test { int a; int b; };")
(c-define-type struct-test (struct "test"))
(define struct-test (c-lambda () struct-test "___result_voidstar = new test;"))
;; test code (load "test")
(define (alloc-struct n) (let loop ((i 0)) (if (< i n) (let ((a (struct-test))) (loop (+ i 1)) (write "FIN")))))
(alloc-struct 100000000000)
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list