Monday, January 23, 2012

Heap Memory In Java


When Java program executes, the JVM uses Heap memory to manage the runtime  data. If your program required more than what memory is allotted then we get OutOfMemoryError.

The heap size may be configured with the following VM options:
·         -Xmx<size> - to set the maximum Java heap size
·         -Xms<size> - to set the initial Java heap size

For example, you can set minimum heap to 126 MB and maximum heap 512 MB for a Java program.





Eclipse:
In Eclipse, The eclipse.ini is a text file containing command-line options that are added to the command line used when Eclipse is started up.




Open the eclipse.ini (any Editor, here I am using Notepad++)



 The minimum size and maximum size can be changed  by using






   -Xms256m
   -Xmx1024m

Save the file.  This is the way you can increase heap memory size.

No comments:

Post a Comment

Spring Boot 3 : JWT with SecurityFilterChain, AuthorizeHttpRequests, RequestMatchers

pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"...