|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.util.MemoryCheck
public class MemoryCheck
This class provides a utility to determine how much memory your application is using at any given time. Useful for determining the memory requirements of a given Object and for debugging possible memory leaks. See JavaWorld article for more info. Includes a sample main method that shows how it might be used.
To get a snapshot of current memory first call runGC()
and then call getUsedMemory()
.
Example code:
MemoryCheck.runGC();
Long currentMem = MemoryCheck.getUsedMemory();
Constructor Summary | |
---|---|
MemoryCheck()
|
Method Summary | |
---|---|
static String |
getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout: |
static long |
getUsedMemory()
Gets the current amount of memory being used by this app, in bytes. |
static String |
getUsedMemoryInMegs()
Gets the current amount of memory being used by this app, in megabytes. |
static void |
main(String[] args)
The main program for the MemoryCheck class |
static void |
runGC()
Runs object finization and the garbage collector several times. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryCheck()
Method Detail |
---|
public static void main(String[] args) throws Exception
args
- The command line arguments
Exception
- If errorpublic static long getUsedMemory()
runGC()
prior to calling this method.
public static String getUsedMemoryInMegs()
runGC()
prior to calling this method.
public static void runGC()
public static String getDateStamp()
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |