On 2013-06-06 12:34, Felix wrote: > From: Thomas Chust <ch...@web.de> >> [...] >> So what about allocating locally and not returning an object but passing >> it to a Scheme callback from inside a foreign-safe-lambda? Is that ok or >> can it happen that the callback stores this object away but never copies >> it into the second generation heap? > > That can indeed happen. > [...]
Hello, interesting! In that case the documentation for foreign-safe-lambda should really be changed, I think. But I wonder how that could happen. C_callback basically has to run a minor garbage collection to unwind the stack before returning to the context enclosing the callback. Hence the only way I can imagine a value escaping the garbage collection is if the context enclosing the callback does a C_alloc but forgets to do a C_callback_adjust_stack and passes some stack allocated object into the callback. Then the garbage collector might think that this object lives in permanent storage and ignore it. Is this reasoning correct? Ciao, Thomas -- When C++ is your hammer, every problem looks like your thumb. _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users