[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Chicken C interface

From: Thomas Chust
Subject: Re: [Chicken-users] Chicken C interface
Date: Thu, 06 Jun 2013 12:46:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 2013-06-06 12:34, Felix wrote:
> From: Thomas Chust <address@hidden>
>> [...]
>> 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.
> [...]


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?


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]