Solved

java garbage collect

Posted on 1997-11-17
2
180 Views
Last Modified: 2010-04-16
I use jvc(just-in-time) compile my program, and use jview to run it.
can I forbid garbage collect to happen until program run out of memory.
I put one System.gc in different place in my program, why does it cost very different runing time in the same program(9 class).
 
0
Comment
Question by:yijun
2 Comments
 
LVL 4

Accepted Solution

by:
russgold earned 50 total points
ID: 1230731
You cannot generally control garbage collection in a system with automatic garbage collection (AG), such as Java.  This is one reason many people don't like AG in real-time systems.  The behavior is simply not predictable.

The normal behavior for most Java VM's is to delay all gc activity until it runs out of memory - or Runtime.gc() is called.
You can take advantage of this fact by adding calls to Runtime.gc() at various non-time-critical points in your system to ensure that a large backlog of unreferenced objects never develops.  Your behavior will still not be entirely predictable, but it should never get to be a problem.
0
 

Author Comment

by:yijun
ID: 1230732
Hi, thanks!
But how to delay gc happen until using out of memory?
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now