List of utility methods to do Memory
boolean | isDefaultMemoryCardDrive(String aRoot) is Default Memory Card Drive if (aRoot.equalsIgnoreCase(iDefaultMemoryCard)) { return true; return false; |
boolean | isInMemoryDatabase(final String databasePath) is In Memory Database return MEMORY_STORE_LOCATION.equals(databasePath);
|
boolean | isMemoryAccess(final String value) Checks whether a string is a memory access identifier string. return value.equals("["); |
boolean | isMemoryData(String metric) is Memory Data if (metric == null) { return false; if (metric.indexOf("mem") > -1) { return true; return false; |
boolean | isMemorySufficient() is Memory Sufficient final long maxMemory = ((Runtime.getRuntime().maxMemory() / 1024) / 1024); final long freeMemory = ((Runtime.getRuntime().freeMemory() / 1024) / 1024); if ((freeMemory) < ((1 * maxMemory) / 100)) { return false; return true; |
void | logMemoryStats(String msg) Log statistics on memory to stderr. Runtime rt = Runtime.getRuntime(); System.err.println( msg + ": total=" + (rt.totalMemory() / 1024) + "KB, free=" + (rt.freeMemory() / 1024) + "KB"); |
long | makeVmMemoryDivisibleBy4(long memory) make Vm Memory Divisible By if ((memory % 4) == 0) { return memory; } else { long temp = memory / 4; return temp * 4; |
void | measureMemoryBefore() measure Memory Before measureMemory("Before");
|
String | memory() memory Runtime r = Runtime.getRuntime(); long max = r.maxMemory() / 1000; return "memory (used/free/max): " + (max - freeMemory()) / 1000 + "/" + freeMemory() / 1000 + "/" + r.maxMemory() / 1000000; |
String | memory() memory String str = ""; str += "memory : " + ((double) Runtime.getRuntime().freeMemory() / (double) Runtime.getRuntime().totalMemory()) * 100 + "% free<br>"; str += "memory total : " + Runtime.getRuntime().totalMemory() + "<br>"; str += "memory free : " + Runtime.getRuntime().freeMemory() + "<br>"; return str; |