Class MemoryUsageStress


  • public class MemoryUsageStress
    extends Object
    Stressing MemoryUsageStress
    Author:
    Michal Babacek Some reading: http://docs.oracle.com/javase/6/docs/api/java/lang/management/MemoryUsage.html http://stackoverflow.com/questions/3422557/sun-jvm-committed-virtual-memory-high-consumption
    • Constructor Detail

      • MemoryUsageStress

        public MemoryUsageStress()
    • Method Detail

      • stressSystemMemory

        public String stressSystemMemory​(int megabytes,
                                         int milliseconds)
        stressSystemMemory JVM will be forced to put up a specified number of megabytes, thus affecting both memory allocated for JVM already and possible the physical memory as well (in case JVM will have to ask for more memory up to the maxMem constant).
        Parameters:
        megabytes -
        milliseconds -
        Returns:
        status before and after the stress