Can any one tell how to monitor JVM heap size usage?
As per my understanding if I write a class A, and it requires a large amount of memory, it's possible that the virtual machine will begin to throw OutOfMemoryError instances when attempting to instantiate objects
In such case we can increase the "heap size" allocated by the Java Virtual Machine (JVM) by using command line options.
But is there any mechanism we monitor the heap size, so that we could be noted before this out Of memory error occurs?
and also I came to know about verbose:gc command. Can anyone tell me how to use this option from console.
I dont think thats possible using log4j, since those are system level logs. However if you want to log those messages to a specific file, you can still do it without using log4j using -Xloggc:D:/log/myLogFile.log where myLogFile.log will contain the logs. This is mentioned in the link that i posted earlier in this thread.