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

why you don't mark objects for GC

 > P.s.  What I was really asking if there is any way to mark an object for 
 > garbage collecting?

No; the reason is this. Suppose you created an object, did (SETF A OBJECT)
and then marked it with (DESTROY OBJECT). Then A is effectively a pointer
to a completely worthless value, and using A causes a bus error. 
Lisp doesn't let you do something this dumb, therefore you never get bus 
errors. The MCL debugger beats the stuffing out of MacsBug any day!

If you don't want an object anymore, you should remove all references to
it. Actually, this isn't any more work on your part than "promising not
to reference A when it points to garbage" in my example above.
If you insist on thinking about object references, you should either do
it right from the start or not at all - halfway leads to bus errors, y'know. 

The result is much cleaner, better designed code for those who take the
time, and a programmer-friendly environment for those who don't
want to be bothered.