chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] sdl.egg v0.2


From: felix winkelmann
Subject: Re: [Chicken-users] sdl.egg v0.2
Date: Wed, 3 Nov 2004 09:43:50 +0100

On Tue, 02 Nov 2004 16:59:10 +0000, Tony Garnock-Jones
<address@hidden> wrote:
> Hi all.
> 
> I've followed Alex' suggestions (I hope in the way he intended - Alex?).
> Attached is sdl.egg, version 0.2. Felix, feel free to publish this one
> if you like. Let me know if there's anything extra you need from me in
> order to do so.

Very nice. Thanks! Some documentation would be nice, though. :-)

> 
> One remaining issue is garbage collection - I don't really have enough
> experience with SDL to know when automatic GC on SDL_Surface is ok
> (although the case for TTF_Font) is pretty clear) - but I plan on
> gaining enough experience to be able to implement something sensible for
> 0.3 :-)
> 

I usually refrain from using finalizers in this case. One never knows where
deep inside SDL the surface might still be in use. One possible approach
would be some dynamically scoped surface-allocation wrapper, like:

(sdl-with-temporary-surface <surface> (lambda (s) ...))

And let dynamic-wind do the cleanup (for example). 
Anyway, I suggest not to use finalizers, but instead push this to the
user. Many surfaces will be created once at startup and live throughout
the whole lifetime of the application. Very short-lived surfaces can
be handled with sth like the above.  For everything else, the user/client
of the library usually knows best about the lifetimes of objects he/she
creates.


cheers,
felix




reply via email to

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