new@udel.EDU (Darren New) (04/10/90)
I've been wondering why Smalltalk-80 assures that a given symbol will always retain the same object number even when nothing is referencing that symbol. I understand the desirability of saying that the same literal will always get the same object, but to insist that this happens even when there is no reference to the symbol seems unnecessary. I have a compiler that compiles Estelle into Smalltalk. It generates a new SYMBOL for each of the items in the Estelle. When I throw away that Estelle code, I'm left with many K of symbols that nobody is referencing. Over time, I wind up with thousands of random symbols left over from previous compilations. Is there an easy and safe way to dispose of these symbols? -- Darren
moss@cs.umass.edu (Eliot Moss) (04/12/90)
There is not really any nice way to get rid of the symbols ... they are being held onto by the symbol table, which is used to make *sure* that each symbol always has the same unique object id within a given Smalltalk image. Some cloners have the ability to discard symbols that are referred to *only* from the symbol table, but I am not sure the standard cloner does that. One would need a new concept (e.g., what some people call *weak pointers*, which continue to point to an object so long as any ordinary pointers do, but turns into nil at a gc that finds there are no longer any ordinary pointers to the same object). The complexity was perhaps judged not to be worth the benefit for typical uses of the system, though that may be cold comfort in your case! Eliot -- J. Eliot B. Moss, Assistant Professor Department of Computer and Information Science Lederle Graduate Research Center University of Massachusetts Amherst, MA 01003 (413) 545-4206; Moss@cs.umass.edu