Leave a comment

Specifying JVM heap size while running a program in eclipse

If you are running a program in eclipse and want the execution to happen with a specific value of heap size, –

  • Right click on application -> Run as.. -> Run Configurations -> Open Argument tab
  • Now, under VM arguments, specify :

          -Xms128m -Xmx256m

  • Here, change the values 128 and 256 with numbers you want to specify. Value given with -Xms (128m) is minimum heap size and value given with -Xmx (256m) is maximum heap size. Value of max memory for JVM can be retrieved using API Runtime.getRuntime().maxMemory().


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: