[racket] Stopping scheme object from being GCed

From: Veer (diggerrrrr at gmail.com)
Date: Sat Jun 5 14:07:09 EDT 2010

Thanks , it works now . I should have reread the memory allocation
part before asking  :) .


On Sat, Jun 5, 2010 at 10:56 PM, Thomas Chust <chust at web.de> wrote:
> 2010/6/5 Veer <diggerrrrr at gmail.com>:
>> How do i stop the scheme values being GCed
>> [...]
>
> Hello,
>
> your C code doesn't register the global variable holding the callback
> procedure with the garbage collector, hence the garbage collector may
> not know that  there is still a reference to the procedure left.
>
> You can register global variables with the precise garbage collector
> using the macro MZ_REGISTER_STATIC or the function
> scheme_register_static (
> http://www.plt-racket.org/docs/html/inside/im_memoryalloc.html#(cpp._scheme_register_static)
> ).
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>


Posted on the users mailing list.