Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.sprintlink.net!EU.net!uunet!psinntp!isc-newsserver!winesap.rc.rit.edu!user
From: semrc@rc.rit.edu (Sigrid E. Mortensen)
Subject: Purging Unused Symbols? (ST/V Win 32) [Repost with cr's!]
Message-ID: <semrc-0111941130040001@winesap.rc.rit.edu>
Sender: news@ultb.isc.rit.edu (USENET News System)
Nntp-Posting-Host: winesap.rc.rit.edu
Organization: RIT Research Corporation
Date: Tue, 1 Nov 1994 16:29:44 GMT
Lines: 53

  Anybody here know how to *really* get rid of unused symbols?  Without 
realizing the implications of my actions, I created a few thousand 
symbols to stress-test some code.  Then I noticed that my image was 
taking an extremely long time to save (and taking up a lot of disk space 
all of a sudden).

  I did a little investigating, and found out that those symbols were 
still around.  I read in the programmer's reference that Symbols aren't 
automatically garbage collected, so I executed the Symbol class method 
"purgeUnusedSymbols."  Didn't work.  The SymbolTable is still the same 
size it was before executing the method.

  I tried a number of different approaches after that (testing for those 
particular symbols and removing them, etc.), some of which corrupted the 
image, so I kept going back to a back-up image....  Finally I just gave 
up and went to an image from before my stress-test.

  I'm still curious, though.  It seems like the method purgeUnusedSymbols 
just doesn't work.  If you create a symbol, say, in a workspace, then try
to purgeUnusedSymbols, the SymbolTable doesn't get any smaller.  This is 
true even if you get rid of the workspace (a potential reference) first.

  If you look at the code for purgeUnusedSymbols, it *seems* like they're 
doing the right thing.  They create a new symbol table (SymbolSet) and 
put the symbols with dlls into it, then they make the SymbolTable nil.  
Theoretically, that *should* remove the references to any unused symbols. 
Next, they do Symbol allInstances, which *should* invoke the garbage 
collector.  Since it doesn't really get rid of unused symbols, I can only 
conclude that either (1) there are still references to those bogus 
symbols [a strong possibility; if I inspect the following....

      (Symbol allIntances at: <index of bogus symbol>) allReferences

I get an array of length two, both of which seem to be SymbolSets!], or 
(2) the garbage collector has a bug in it.

  Is this a known Digitalk bug?  Has anybody figured out a work-around?  
I've avoided the immediate problem by going back to an old image, but I 
noticed a number of other bogus Symbol instances when I was looking (some 
of which seem to be put in by WindowBuilder, i.e., partial method names), 
and I can imagine my image just getting bigger and bigger with this junk.

  Thanks for any insights,

  -- Sigrid.

-- 
|=|===============|============================|=|=================|=
|||  Sigrid E.   ||| RIT Research Corporation  |||     phone:     |||
|||  Mortensen   ||| Object Innovations Group  ||| (716) 475-6761 |||
||| Sr. Computer ||| 75 High Power Road        |||      fax:      |||
|||  Scientist   ||| Rochester, NY 14623       ||| (716) 475-2361 |||
|||==============|=|============================|=================|=|
