|
From: Leif M. <le...@ta...> - 2007-01-30 18:41:53
|
Hubert,
The Wrapper doesn't do anything itself but the JVM has support for this.
Take a look at the java.lang.Runtime class. You will find the freeMemory(),
maxMemory(), and totalMemory() methods. totalMemory() is the amount
of allocated memory. To find out how much is actually being used, do this
inUseMemory = rt.totalMemory() - rt.freeMemory();
Note that those two calls are NOT synchronized. If a memory allocation
is made at the right moment, it may be possible to get strange values
for inUseMemory...
On Windows, the following two properties exist on an experimental basis
They are not supported and I reserve the right to change them in the future,
but you might want to try playing around with them. If I can figure out a
way to do the same thing on UNIX platforms, there are some things I
would like to do with this data. Logging it is not all that interesting.
wrapper.memory_output=TRUE
wrapper.memory_output.interval=60
Here are the meanings of the output:
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_STATUS,
"Wrapper memory: %lu, %lu (%lu), %lu (%lu), %lu (%lu), %lu
(%lu) Java memory: %lu, %lu (%lu), %lu (%lu), %lu (%lu), %lu (%lu)",
wCounters.PageFaultCount,
wCounters.WorkingSetSize, wCounters.PeakWorkingSetSize,
wCounters.QuotaPagedPoolUsage,
wCounters.QuotaPeakPagedPoolUsage,
wCounters.QuotaNonPagedPoolUsage,
wCounters.QuotaPeakNonPagedPoolUsage,
wCounters.PagefileUsage, wCounters.PeakPagefileUsage,
jCounters.PageFaultCount,
jCounters.WorkingSetSize, jCounters.PeakWorkingSetSize,
jCounters.QuotaPagedPoolUsage,
jCounters.QuotaPeakPagedPoolUsage,
jCounters.QuotaNonPagedPoolUsage,
jCounters.QuotaPeakNonPagedPoolUsage,
jCounters.PagefileUsage, jCounters.PeakPagefileUsage);
Cheers,
Leif
Hubert Felber wrote:
> Hello,
>
> Is there a way to monitor memory usage of a service other then to use
> a filter for "OutOfMemory" on the console?
>
> Thank you
> hub
>
|