Application Security Testing: An Integral Part of DevOps

After successive development exposure, we understand the needs of our application. Java allows you to start the application with specifications as required and the application is bound to use the specification and work.

java -Xms20m -Xmx1G MemoryViewAdvanced

Please note the arguments -Xms and -Xmx. Here Xms is the initial heap size that the can use to start with and Xmx will the maximum heap size that this contextual can use. These values can be effectively used to manage memory as required.

Code snippet:

public class MemoryViewAdvanced
{
   public static void main(String args[])
   {
      MemoryViewAdvanced memoryViewAdvanced = new MemoryViewAdvanced();
      memoryViewAdvanced.proceed();
   }
      
   private void proceed()
   {
      //Total memory available for the jvm
      System.out.println("Runtime.getRuntime().totalMemory(): " + Runtime.getRuntime().totalMemory());
      //Free memory available
      System.out.println("Runtime.getRuntime().freeMemory(): " + Runtime.getRuntime().freeMemory());
      //Max memory available in the System
      System.out.println("Runtime.getRuntime().maxMemory(): " + Runtime.getRuntime().maxMemory());
   }
}

 

Visit the DevX Tip Bank

 



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here