Most Popular Posts

18/04/2013

Define Heap Size/ Memory management


Define Heap Size/ Memory management

HotSpot
JRockit
Function
-Xmx:[size]

Xmx sets the maximum size of the heap. Maximum value should be the maximum available, but in such a way that it does not cause any error, or about 75% of the system physical memory (depends on the OS).

-Xms:[size]

Xms sets the minimum & initial size of the heap. Recommended to set the same value as the Xmx to minimize allocation overhead of the heap.


-Xmn, -XXNewSize, -XXMaxNewSize

-Xns
Xns sets the size of the Young/ Nursery generation heap. This is the place where new objects land in the first place before being promoted to the other space.

XX:NewSize - Use   this option to set the New generation Java heap size. Can be set to be one-fourth the size of the maximum heap size. Increase the value of this option for larger numbers of short-lived objects.

-XX:MaxNewSize - Use this option to set the maximum New generation Java heap size.

-verbose:gc

-Xverbose:memory

Prints the additional information
-XX:+AggressiveHeap

XXaggressive:memory

Configures the memory system for memory-intensive workloads and sets an expectation to enable large amounts of memory resources to ensure high throughput. The JRockit JVM will also use large pages, if available.

XX:+UseConcMarkSweepGC

Xgc:singlecon

Sets the garbage collector to use a concurrent strategy


XX:+UseParallelGC

Xgc:parallel

Sets the garbage collector to use a parallel strategy



Specifies what to prioritize: even pause times or maximum throughput



Specifies a suitable pause time for the application

-XX:MaxPermSize


Define Maximum heap for the Perm Genaration.
.

(Permanent generation) (non-heap) Stores classes, methods and other meta data



Other settings:


  • -Xss - If the thread stack size (-Xss) has not been set the default value depends on the threading system and the platform you are running on. When using thin threads the minimum thread stack size is 8 kilobytes and the default is 64 kilobytes. When using native threads the minimum thread stack size is 16 kilobytes. For Windows the default thread stack size when using native threads is 64 kilobytes and for Linux it is 128 kilobytes.


  • -XX:SurvivorRatio - The New generation area is divided into several sub-areas: Eden, Survival Space I and Survival Space II. Use the -XX:SurvivorRatio=X option to configure the ratio of the Eden/Survivor Space size. When it is 1:x Eg., -XX:SurvivorRatio=6 - each survivor space will be 1/8 the young generation).

  • –XX:NewRatio=n is used divide heap into old and new generation. If we use. -- XX:NewRatio=5, then you create an old-to-new ratio of 5:1; the old generation occupies 5/6 of the heap while the new generation occupies 1/6 of the heap (-XX:NewRatio=3 - the young generation will occupy 1/4 the overall heap).




Tables were taken from the Oracle website, and changed to suit the blog.


No comments:

Post a Comment