[gclist] weak pointer and gc
Ji-Yong D. Chung
Sat, 14 Apr 2001 12:30:49 -0400
These question is regarding a symbol
table and garbage collector..
I have heard that, to implement a symbol
table properly for a sheme interpreters,
one has to use weak pointers.
That way, it can be garbage collected.
Is this important for garbage collection
I know that most local symbols (unless they are
quoted) in scheme-expressions are converted, within
a Scheme interpreter, into objects that represent
lexical addresses. Thus, unless the symbols are
used globally, the symbols are unlikely to be needed
when the interpreter is running.
Does the weak-pointer table gain you much
in reducing memory?
It seems that such a weak-pointer symbol table
is expensive to maintain. At the garbage
collection time, the collector probably has zero
out the weak pointer references. Later when
the table is accessed, via an accessor method,
the table entries and overflow
chains probably need to be cleaned up.
P.S. Some time ago, there was a discussion
thread on using hashtables for XML. If
XML file was read into a GC collected
environment. Would it be advisable to use
weak pointered hashtable here (to