[comp.sys.ti.explorer] Relinquishing large data structures.

darel@maccs.dcss.mcmaster.ca (Darel Mesher) (06/10/91)

Hello, 

I am developing an application in KEE which handles very large 
data structures.  During the course of reasoning on the data 
set, some data structures are replaced by others.  I was wondering
what the most efficient way is to reclaim this storage 
space?  Is there a way to inform the garbage collector that this 
data structure (typically ~10Mbytes) is no longer active
and should therefore, be reclaimed as garbage?  I have looked
through the microExplorer manuals but have not found any
suitable reference to controlling the GC mechanism in this fashion.  

Any suggestions would be appreciated.

Thanks,
   Darel.


-- 
=============================================================================
Darel Mesher		     VE3DLT	
Electrical and Computer Engineering
McMaster University			    darel@maccs.dcss.mcmaster.ca

jwz@lucid.com (Jamie Zawinski) (06/12/91)

In article <285372BC.8478@maccs.dcss.mcmaster.ca> darel@maccs.dcss.mcmaster.ca (Darel Mesher) wrote:
> 
> Is there a way to inform the garbage collector that this data structure
> (typically ~10Mbytes) is no longer active and should therefore, be
> reclaimed as garbage?  I have looked through the microExplorer manuals
> but have not found any suitable reference to controlling the GC mechanism
> in this fashion.  

One solution is to make your own memory area, bind DEFAULT-CONS-AREA to that,
cons your enormous data structure there, and then cut that area free when
you're done with it.  If you free the memory but still hold a pointer into it,
you will lose like a C hacker.

Depending on your application, using WITH-STACK-LIST might do the trick as
well.

Probably if you want to explicitly free this object, there are better ways to
go about it.  I'm guessing one of two things is wrong: you're running out of
memory, or you're garbage collecting constantly, making everything slow down.
If you're running out of memory, it's probably because the GCer isn't keeping
up with the data you're cutting loose, rather than because you have actually
exhaused all of memory with live data.  The GC is probably spending all of its
time looking at pages it shouldn't be bothering with.  If you place all of
your long-lived data (well, data with similar lifetimes) in the same area(s),
then those pages will be propagated to higher generations soon, and the data
that is in the lower generation pages will be more likely to be collectible.
Since GC looks at these pages first, it will do a better job.

Check out the chapter on storage allocation in the System Software Design
Notes. 

	-- Jamie

PS: If you ditch KEE, you'll have a lot more room for your data, not to
mention that fact that your application will probably run an order of
magnitude faster...  (This has been an editorial comment from the Society 
for the Eradication of AI Tools and Other Parasites. :-))