- public static long memPercent(int percent)
- {
- return memPercent(percent);
- }
- public static long memPercent(float percent)
- {
- long memPercent = -1;
-
- long physicalMem = getPhysicalMemory();
- if (physicalMem > MemorySetting.applicationMinMemory)
- {
- // try and set at least applicationMinMemory and thereafter ensure
- // leaveFreeMinMemory is left for the OS
- memPercent = Math.max(MemorySetting.applicationMinMemory,
- (long) (physicalMem
- - Math.max(physicalMem * (100 - percent) / 100,
- MemorySetting.leaveFreeMinMemory)));
- }
-
- return memPercent;
- }
-