At Mon, 4 Mar 2013 06:35:03 -0700, Jay McCarthy wrote: > My understanding is that in your version, the Racket object is only > available via the Chipmunk/C data structure, which the GC views as > opaque, so it is collected. If you want to put Racket things in C > objects, you'll have to make sure they are retained on the Racket > side, by (for example), also storing them in a hash table and > monitoring access to the C objects.
Retaining a reference to the value from elsewhere won't be enough, usually. The GC might move the value, in which case the C data structure's field will point to the wrong place. > On Sat, Mar 2, 2013 at 8:35 AM, Sam Vervaeck <[email protected]> wrote: > > I have looked into (malloc-immobile-cell > > v) and (free-immobile-cell cptr) but I am not sure that fiddling with the > > memory is such a good idea. Could you please give me any guidelines or point > > me to a procedure I can use to provide this functionality? The `malloc-immobile-cell' and `free-immobile-cell' functions really are the way to go. ____________________ Racket Users list: http://lists.racket-lang.org/users

