On Thu, 13 Dec 2012 19:50:01 +0100 Peter Enerccio <[email protected]> wrote:
> Is it possible for automatic memory reclamation when object is no longer > needed (ie it's parent foreign type has been disposed in the ecl memory)? > > Or the same equivalent for defclass made class instance. > > The reason being, in sdl, you must call SDL_FreeSurface when it's no longer > needed and it would be appropriate to call it when object holding the > reference to it (or class holding the reference to the object) is being > disposed by the system. I agree with all that juanjo said; Note also that it's common in lisp to use WITH- macros making use of UNWIND-PROTECT, such that code can easily ensure that an object be closed or freed when no longer needed. This could be faster than using finalizer functions when it's possible. At http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/~checkout~/mmondor/mmsoftware/cl/test/mmffi-sdl.lisp?content-type=text%2Fplain you'll see a few examples of such macros: WITH-SDL-SURFACE (to ensure that we free the surface), WITH-SDL-LOCK (to ensure that unlocking be done). Because of garbage collection, objects which only consist of memory and have no associated OS resources (such as non-video surfaces) may not need any special treatment, unless they're considered too large and increasing the heap is not wanted (and the heap fills too fast causing frequent gc runs increasing latency). -- Matt ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Ecls-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ecls-list
