We help IT Professionals succeed at work.

How to find out what is the current heap size on shared hosting?

Loganathan Natarajan
on
Medium Priority
2,136 Views
Last Modified: 2008-02-20
How do I find the current heap(jvm size) is assigned to my website? I am running tomcat 5.5 with Linux OS.. i have only FTP access to upload files ..

how can i find the details ? any script to identity.,
Comment
Watch Question

Commented:
try this;


 
    // Get current size of heap in bytes
    long heapSize = Runtime.getRuntime().totalMemory();
   
    // Get maximum size of heap in bytes. The heap cannot grow beyond this size.
    // Any attempt will result in an OutOfMemoryException.
    long heapMaxSize = Runtime.getRuntime().maxMemory();
   
    // Get amount of free memory within the heap in bytes. This size will increase
    // after garbage collection and decrease as new objects are created.
    long heapFreeSize = Runtime.getRuntime().freeMemory();
Loganathan NatarajanLAMP Developer
CERTIFIED EXPERT

Author

Commented:
thanks, it works

Explore More ContentExplore courses, solutions, and other research materials related to this topic.