Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!uwm.edu!reuter.cse.ogi.edu!qiclab.scn.rain.com!slc.com!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: Question concerning RAM
Message-ID: <1996Feb23.192238.3923@slc.com>
Sender: news@slc.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <4gcrup$75i@titan.saturn.net>
Date: Fri, 23 Feb 1996 19:22:38 GMT
Lines: 43

kevinl@saturn.net writes:
<snip>
> ...  The problem appears to
> be related to the garbage collection facility within Smalltalk.  We
> tend to think that this mechanism does not do an adequate job, and are
> forced to explicitly release memory.  However, in either case, when
> instances of objects are invoked, they never seem to be dropped and
> any available RAM is chewed up until the application returns the
> message "resource unavailable".
> 
> Is this flavor of Smalltalk just a hog and requires additional RAM is
> thrown at it, or, is there a known solution for this problem?

Nope - the garbage collector is doing its job just fine.  Most likely,
you are not doing yours.  The classic cause of growing images is
keeping references to unwanted objects.  As long as there is any path
from the Smalltalk dictionary to an object, it cannot be garbage
collected.  (Note that the mark sweep garbage collector does not rely
on reference counts, so circular structures of objects are garbage
collected just fine, as long as there are no outside references to
any of the objects.)

Your job is to track down the objects you believe should be garbage
collected and find the references to them.  You will find some method
in Object (#allOwners for VW, #allReferences in VA) that allows you
to track down the objects having those references.  Nilling these
references will allow the object to be garbage collected.

The classic place to start looking for problems is the dependents
dictionary.  Application caches (of objects retrieved from a
database, for example) are another place.

I have heard that Kent Beck (http://www.bytesmiths.com/) makes a
nice visual tool for tracking down object references, but I have not
used or seen it.  (I have used a similar tool made by Ward Cunningham,
which was very useful, but it is not commercially available, sigh...)

  Hope this helps,
  Alan
    (standard disclaimer)



