This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Performance and the fly likes Yourkit profiler - option to force GC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Yourkit profiler - option to force GC" Watch "Yourkit profiler - option to force GC" New topic

Yourkit profiler - option to force GC

Suma Rangaraj
Ranch Hand

Joined: Feb 02, 2005
Posts: 50

Hello all-

I am confused with the option that is given in Yourkit profiler. They have an option to explicitly force GC before taking a snapshot of memory.
Haven't we told time again that a GC cannot be forced? So what does this option mean?

Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 396

Its not guaranteed to work but does (Sun VM) unless you explicitly disable it with a command line option (DisableExplicitGC). (You need to check your VM's documentation or just do it and observe the results ;-) )

Attach visual WM and force a GC and you can see the results, we do it all the time for debugging purposes.

Obviously writing a program relying on this behaviour is different, there's no guarantee it'll do anything.

"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
I agree. Here's the link:
subject: Yourkit profiler - option to force GC
Similar Threads
Question on Heap?
cannot create Hibernate project.
java process memory and heap size
How to analyze the performance of java program
Stateful session bean calling @remove method from client