The Runtime.totalMemory() is supposed to be the total amount of memory
the vm heap has available for use. I was having a hard time correlating it
exactly with the linux top output so I looked at how it was implemented in
1.3.0 and stopped when I got down to the JVM_TotalMemory() native
function which is what Runtime.totalMemory() calls:
j2sdk1_3_0-src-linux/src/share/javavm/runtime/gc.c:
static long FreeObjectCtr; /* # bytes of objects free */
static long TotalObjectCtr; /* # bytes of objects space allocated so far */
static long MinTotalObjectCtr; /* minimum size of object space in bytes */
static long FreeHandleCtr; /* # bytes of free handles (not # of handles) */
static long TotalHandleCtr; /* # bytes of handles allocated so far */
static long nfreed = 0; /* # of blocks freed in last gc */
static long bytesfreed = 0; /* # of bytes freed in last gc */
static long expanded; /* # of bytes expanded/shrunk since last gc */
JNIEXPORT jlong JNICALL
JVM_TotalMemory(void)
{
return ll_add(TotalObjectMemory(), TotalHandleMemory());
}
int64_t
TotalObjectMemory(void)
{
return int2ll(TotalObjectCtr);
}
int64_t
TotalHandleMemory(void)
{
return int2ll(TotalHandleCtr);
}
----- Original Message -----
From: "Hiram Chirino" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 23, 2001 5:41 PM
Subject: Re: [JBoss-dev] JMS thread usage
>
>
> Darn, I was hoping you had some other quick trick. Well, since I figured
> that viewing thread dumps would be a usefull thing for not only development
> but maybe even for the daily operations of JBoss, I've add JMX accessible
> method to the "Info" MBean so that it will give you that dump. I also have
> it giving you the memory useage. But the memory usage that it is reporting
> seems off. Anybody have any clue to how the Runtime.totalMemory() function
> relates the amount of memory that is used by the java process??
>
> Regards,
> Hiram
>
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development