-
Enhancement
-
Resolution: Duplicate
-
P5
-
None
-
1.1.6
-
generic
-
generic
Name: bk70084 Date: 07/20/98
There was going to be some sort of API in JDK 1.2 to allow querying the
VM for the state of the memory pool. I believe that has been pulled from
the release.
I would like to request a different API than the one that has been dropped.
What is really important for applications to know is:
(1) How big is the memory pool, and how much is currently free.
(2) How much is it allowed to grow (i.e., what is
the -mx option)
(3) How often is the garbage collector running. (This is
the most important, actually.)
#1 is already available
#2 is useful to know so that you can get a feeling for
how much more your application can do before it gets
into trouble
#3 allows an application to tell whether it's GC bound.
This is a common problem in Java, where the application
would be doing just fine if the garbage collector wasn't
running all the time.
An interface to the system that looks something like this
would be great:
interface GCInfo {
/** Return the current size of the heap. */
int getPoolSize();
/** Return the amount currently allocated. */
int getPoolAvailable();
/** Return the amount of time spent running the gc in ms. */
int getGCTime();
/** Grow the heap by X bytes (if possible). */
boolean growHeap(int amount);
}
The getGCTime() method makes it possible for an application to
accurately gage how much time it is spending running the GC. For
example, an application get check this statistic once every 10
seconds, and if it finds that it spent 9000 ms running the GC, then
it knows that the garbage collector is running almost all the time.
When that occurs, the application could attempt to grow the heap to
cut back on the amount of time spent in GC.
Also, it would be great if the growHeap method could support negative
AMOUNT arguments, and somehow return the heap to the operating system.
(Review ID: 34229)
======================================================================
- duplicates
-
JDK-4530538 JVM monitoring and management API
-
- Resolved
-