[cffi-devel] Re: unnamed callback (closures?)

James J Bielman jamesjb at jamesjb.com
Tue Feb 7 17:49:18 UTC 2006


On Feb 7, 2006, at 12:51 AM, Jan Rychter wrote:
>
> However, I'm puzzled as to why you decided not to name the callback  
> and
> remember it. Is there really no way to release the memory occupied by
> the trampoline code and let the closure be GCd when it's no longer
> needed?
>
> In my case, this is going to be a problem. If you generate a bunch of
> callback-lambdas for each context menu appearance, you will soon  
> end up
> with lots of them in memory. If there really is no way to release  
> them,
> I'll probably have to think of a different approach (with dispatching
> functions, I guess, as Martin suggested).

Well, the idea was to also add an interface for freeing the callbacks
(if that is necessary on a particular Lisp), I just haven't gotten  
there yet.

I don't see how you could free them with finalizers since they won't
know about references held by foreign code.

James




More information about the cffi-devel mailing list