chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Allocation of data for use in return values


From: Zbigniew
Subject: Re: [Chicken-users] Allocation of data for use in return values
Date: Tue, 23 Jan 2007 12:06:32 -0600

Felix had mentioned using callbacks for allocation in this message as well.

http://lists.gnu.org/archive/html/chicken-users/2003-10/msg00027.html

I didn't mention this and other "advanced" techniques because,
basically, while looking at the Gauche Objective C bridge a while ago,
I came up with all kinds of crazy techniques to do allocation. Looking
back at my notes, they are not pretty.  The problem was I was trying
to translate Gauche-style allocation in an overly literal manner to
Chicken.  Eventually I rethought the problem and totally scrapped the
existing code in favor of something written with Chicken's style in
mind.  This allowed me to use just the two techniques I mentioned
originally.  (I did have to use GC roots too, but only to hold Scheme
closures for long periods inside libffi user data.)

What I'm saying is, you may gravitate to doing something that's overly
complex in Chicken because you come from a background with a different
allocation mentality, such as Scheme48.  Then again, maybe everyone
has to go through the
furious-poring-through-Chicken-mailing-list-and-internals phase once.

Also, remember to take into account that callbacks into Scheme are
comparatively slow.

On 1/23/07, felix winkelmann <address@hidden> wrote:
Another possibility would be to allocate Scheme data in a Scheme callback
and put the returned value into a GC root (CHICKEN_gc_root_new). That
way you can manipulate the Scheme data in C and are sure that it is
updated by the garbage collection.


cheers,
felix





reply via email to

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