I have a problem that how to release the memory of objects created
through make-instance. Does the MCL garbage collector is so clever to
collect these memory back or I must explicitly call some functions to
free these memory?
In article <··········@debbie.cc.nctu.edu.tw> Yao-Sheng Cheng <········@twin1.src.ncu.edu.tw> writes:
I have a problem that how to release the memory of objects created
through make-instance. Does the MCL garbage collector is so clever to
collect these memory back or I must explicitly call some functions to
free these memory?
Instances are no different from any other Lisp thing: if the instance not
accessible, it will be garbage collected. For example:
(setq x (make-instance ...))
This instance is now accessible, via the symbol x. If you want it to be garbage
collected, you make it inaccessible, by making x point to something else:
(setq x nil)
Now the instance is garbage (if it's not accessible any other way), and will be
reclaimed sometime.
Generally, you never have to worry about garbage collection. There are no
functions you need to call to reclaim this memory. Why do you say this is a
problem to you?
Scott D. Anderson
········@cs.umass.edu