[racket] Stopping scheme object from being GCed

From: Thomas Chust (chust at web.de)
Date: Sat Jun 5 13:26:35 EDT 2010

2010/6/5 Veer <diggerrrrr at gmail.com>:
> How do i stop the scheme values being GCed
> [...]


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 (


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.