Reputation: 1152
I want to controller the old generation size of the java heap. And I have these settings below:
-Xmx1024m -XX:MaxNewSize=640m -XX:NewSize=640m -XX:SurvivorRatio=5 -XX:-UseAdaptiveSizePolicy -XX:PermSize=32m -server
After launch the application, I execute "jmap -heap pid" and it shows:
Attaching to process ID 96921, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.51-b03
using thread-local object allocation.
Parallel GC with 4 thread(s)
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 671088640 (640.0MB)
MaxNewSize = 671088640 (640.0MB)
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 5
PermSize = 33554432 (32.0MB)
MaxPermSize = 85983232 (82.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 480247808 (458.0MB)
used = 81462752 (77.68893432617188MB)
free = 398785056 (380.3110656738281MB)
16.962649416194733% used
From Space:
capacity = 95420416 (91.0MB)
used = 61444600 (58.59813690185547MB)
free = 33975816 (32.40186309814453MB)
64.39355703500601% used
To Space:
capacity = 95420416 (91.0MB)
used = 0 (0.0MB)
free = 95420416 (91.0MB)
0.0% used
PS Old Generation
capacity = 5767168 (5.5MB)
used = 90128 (0.0859527587890625MB)
free = 5677040 (5.4140472412109375MB)
1.5627774325284092% used
PS Perm Generation
capacity = 35127296 (33.5MB)
used = 35092152 (33.46648406982422MB)
free = 35144 (0.03351593017578125MB)
99.89995244723647% used
15721 interned Strings occupying 1939128 bytes.
My problem is why the old size is 5mb, I think it should be 300+mb = MaxHeapSize - NewSize - PermSize = 1024 - 640 - 32
What's wrong with my setting and how can I control the old size?
Upvotes: 2
Views: 5710
Reputation: 43042
You're not setting a minimum heap size, thus allowing the old gen to grow/shrink. Adaptive size policy only affects the new/old gen boundary. Set -Xms1024m
.
Considering that you didn't even know that I suspect the selection of your other parameters may be ill-informed. I would recommend setting high-level goals (pause times, throughput, heap free ratios) instead and letting the heuristics do their work.
Recommended reading: Hotspot GC Tuning Guide
Upvotes: 1