2011-06-21 14 views

答えて

1
// 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(); 

はまた、このRuntime Java Documentation.

+0

maxMemory方法は、とにかく有効な回答をCLDC 1.1に欠けますがされて参照してください。 – Trax

関連する問題