Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

prevent a garpage Collection

Thread view: 
Velmurugan - 21 Mar 2007 12:16 GMT
hi
can we prevent a garpage Collection in java
if so how is it possible
usenetuser@hotmail.co.uk - 21 Mar 2007 12:20 GMT
> hi
> can we prevent a garpage Collection in java
> if so how is it possible

No.
Ingo R. Homann - 21 Mar 2007 13:00 GMT
Hi,

>>hi
>>can we prevent a garpage Collection in java
>>if so how is it possible
>
> No.

Or... Yes - simply keep a reference to the Object you want to prevent
from being collected. :-)

Or... Please describe your question in detail.

Ciao,
Ingo
Mark Space - 21 Mar 2007 18:51 GMT
> Hi,
>
[quoted text clipped - 8 lines]
>
> Or... Please describe your question in detail.

Go not to the Internet Elves for advice, for they will say both "WTF,
dude?!?" and "RTFM!!"  ;-)
Velmurugan - 22 Mar 2007 09:48 GMT
> > Hi,
>
[quoted text clipped - 12 lines]
> Go not to the Internet Elves for advice, for they will say both "WTF,
> dude?!?" and "RTFM!!"  ;-)

hey
not in program
while running the program is there any option to prvent the garpage
collection daemon
it means i ma talking abt garpage collectioon daemon
Ingo R. Homann - 22 Mar 2007 09:59 GMT
Hi,

>>>>No.
>
[quoted text clipped - 3 lines]
> collection daemon
> it means i ma talking abt garpage collectioon daemon

Then, the above answer is correct. The only possibility to influence the
GC is to use the commandline options and to call System.gc() (which does
the opposite of "preventing" gc).

Ciao,
Ingo
usenetuser@hotmail.co.uk - 22 Mar 2007 13:09 GMT
> Hi,
>
[quoted text clipped - 12 lines]
> Ciao,
> Ingo

Of course, System.gc() only *suggests* to the virtual machine that you
want the garbage collector to run at that point -- the vm doesn't
actually have to do it then, or reclaim all unreferenced memory.
Oliver Wong - 27 Mar 2007 18:51 GMT
> Hi,
>
[quoted text clipped - 9 lines]
> GC is to use the commandline options and to call System.gc() (which does
> the opposite of "preventing" gc).

   Perhaps you could run the VM in debugging mode, and then find the GC
thread, and pause it indefinitely (this is assuming your VM implementation
actually dedicates an entire thread to the GC, and promises not to do any
GC-ing in other threads).

   - Oliver
Esmond Pitt - 22 Mar 2007 11:10 GMT
> can we prevent a garpage Collection in java
> if so how is it possible

Why?
harborsparrow - 22 Mar 2007 13:08 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.