On Mar 22, 6:10 am, Esmond Pitt <esmond.p...@nospam.bigpond.com>
wrote:
> > can we prevent a garpage Collection in java
> > if so how is it possible
>
> Why?
Usually the GC daemon will only "take over" if the heap has become
full. Possibly this can be made to happen much less often by properly
disposing of objects as you go along. If you are creating really
large objects in the heap and not disposing them properly, the GC will
have to run.
You might need to profile your application to see if that is happening.
Lew - 22 Mar 2007 13:40 GMT
> Usually the GC daemon will only "take over" if the heap has become
> full. Possibly this can be made to happen much less often by properly
> disposing of objects as you go along. If you are creating really
> large objects in the heap and not disposing them properly, the GC will
> have to run.
Meaningless advice. Disposing of objects "properly" or not has no effect on
how often GC runs, only on how much it reclaims when it does.
In fact the programmer cannot "dispose" of objects in any case, only
dereference them. It is the GC that disposes of the objects.
The GC runs when heap gets cramped, which happens from the /creation/ of objects.
The only way to try to prevent GC from running is not to create objects, which
of course, is silly.
-- Lew