[Mono-list] How do I force a garbage collection / free a heap

Mike Christensen mike at kitchenpc.com
Sun Nov 15 19:04:43 EST 2009


Hi all -

I have a program that generates some results, but in order to do so it
must load a whole lotta stuff into memory for calculations.  When this
is done, I only need the results and not the data in memory.  This
data might be several hundred megs on the heap or more.

When I'm done, I want to "free" this data and not have it sit around
and slow down stuff.  Is there a way to force a GC cycle or just say
"delete these objects"?  Is there a better design for this sort of
thing (like can I create my own heap and just release the whole thing
at once?)  Also, I'm aware that GC will freeze all threads while it
works, which is okay since I only do this when the application starts
and I don't mind if the start-up costs are slow (since it's a web
site)..

Any pointers would be great!

Mike


More information about the Mono-list mailing list