Again. Resource deallocation in Common Lisp.
From: Lisptracker (lisptracker_at_mail.ru)
Date: 10/28/04
- Next message: Gareth McCaughan: "Re: C++ sucks for games"
- Previous message: josephoswaldgg_at_hotmail.com: "Re: Prototype based programming in Lisp"
- Next in thread: Kenneth Tilton: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Kenneth Tilton: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Christopher C. Stacy: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Duane Rettig: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Lisptracker: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Rahul Jain: "Re: Again. Resource deallocation in Common Lisp."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Oct 2004 15:32:49 -0700
Hi
Since the topic of resource allocation/deallocation was rised during
"Lisp vs C++" discussion I should ask here about it again.
Somebody said that the problem is solved with help of macro like
WITH-OPEN-FILE, but I didn't see solution in case when you opened file
during creation of some object and should close file immediately if
you lost all references to it in order to allow other
objects/applications to open that file.
The only thing I have thought up is to link resource holder object to
GC and assign "special free action" (finalizer) function so GC will
apply the function to the object and call proper deallocator.
Consider you have an instance which holds a slot with the AVI player
object. When you create the AVI player object it exclusively locks AVI
file. Than you assign another AVI file to this slot and the old file
will never be closed (at least until next GC). Of course I could check
slot and deallocate old resource when new resource is assigned, but
what if I've lost references to the object which holds the AVI player
(consider it was destroyed as part of another complex object) ?
So question is about deallocation of small (for GC) resources with
indefinite extent which can be shared between multiple objects in
program.
We are currently porting C++ project to Lisp (photogrammetry,
eye-tracking) and looking for analogue of destructors. May be solution
is to create something like resource managers (monitors) ?
Thanks in advance
Lisptracker
- Next message: Gareth McCaughan: "Re: C++ sucks for games"
- Previous message: josephoswaldgg_at_hotmail.com: "Re: Prototype based programming in Lisp"
- Next in thread: Kenneth Tilton: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Kenneth Tilton: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Christopher C. Stacy: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Duane Rettig: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Lisptracker: "Re: Again. Resource deallocation in Common Lisp."
- Reply: Rahul Jain: "Re: Again. Resource deallocation in Common Lisp."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|