Giving instructions to the GC

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Giving instructions to the GC

Fernando Rodriguez
Hi,

Is it possible to give instructions to the GC, such as "don't gc while
in this block" or "now is a good moment to GC"?

Thanks


Reply | Threaded
Open this post in threaded view
|

Re: Giving instructions to the GC

Andy Bower-3
Fernando,

> Is it possible to give instructions to the GC, such as "don't gc while
> in this block" or "now is a good moment to GC"?

Well you can't really turn it off completely. Some collection is
performed incrementally as the method stack frames collapse. Cycles
collection and finalization are deferred and performed by separate
processes.

What you can do, however, is force this latter type of GC to occur at a
"good moment" by executing:

MemoryManager current collectGarbage
        or
MemoryManager current compact

See the method comment in MemoryManager>>collectGarbage for details.

Best regards

Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: Giving instructions to the GC

Chris Uppal-3
Andy Bower wrote:

> Well you can't really turn [GC] off completely. Some collection is
> performed incrementally as the method stack frames collapse.

Aha!  I've suspected for a while that the Dolphin GC wasn't using only the
"advertised" unsophisticated mark-n-sweep -- it keeps up with heavy loads much
to well for that to be entirely plausible...

    -- chris