Starting JVM with Memory of User’s Choice

Starting JVM with Memory of User’s Choice

After successive development exposure, we understand the memory needs of our application. Java allows you to start the application with memory 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 JVM can use to start with and Xmx will the maximum heap size that this contextual JVM 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());   }}
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular