Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

java garbage collect

Posted on 1997-11-17
2
183 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

839 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