Andrew Davison
Full Member   Posts: 120
|
 |
«
on:
2005-11-14 21:18:15 » |
|
Dear All,
Does anyone know the default settings for the various heap spaces when using the 5.0 hotspot client on Windows XP?
For example, when I run an application using java with no additional options, what are the initial, default sizes for the eden space, tenured space, permanent space, and the new and survivor ratios?
I've found partial information for the server JVM on 32-bit Solaris, but almost nothing for other platforms.
This sort of information should be part of the java tool documentation, or be accessible as Property values.
- Andrew
|
Dr. Andrew Davison Dept. of Computer Engineering Prince of Songkla University, Hat Yai Songkhla 90112, Thailand
|
|
|
Azeem Jiva
Jr. Member   Posts: 92 Medals: 1
Java VM Engineer, Sun Microsystems
|
 |
«
Reply #1 on:
2005-11-14 22:25:00 » |
|
Its different based on hardware architecture, OS, and compiler but here are some general numbers:
X86: MaxHeapSize= 64m NewSize = 640k PermSize = 12m MaxPermSize = 64m
You can look up most of this info in the source code, its all in src/share/vm/runtime/globals.hpp and src/cpu/<arch>/vm/globals.hpp (or c1_globals_<arch>.hpp
|
|
|
|
|
swpalmer
JGO Kernel      Posts: 3438 Medals: 4
Where's the Kaboom?
|
 |
«
Reply #2 on:
2005-11-14 22:36:29 » |
|
+1 for making the current values for these things accessible via a runtime property.
|
|
|
|
Games published by our own members! Go get 'em!
|
|
Andrew Davison
Full Member   Posts: 120
|
 |
«
Reply #3 on:
2005-11-15 02:03:33 » |
|
Thanks for the numbers, which are surprising.
If the young generation starts at 640 KB, then this means that the tenured space starts at only 5 MB (assuming the NewRatio is 8 ).That's a low starting value.
Also, eden space will be only 512 KB, since the survivor spaces are 64KB; more small defaults.
Are there any reasons for choosing these numbers?
- Andrew
|
Dr. Andrew Davison Dept. of Computer Engineering Prince of Songkla University, Hat Yai Songkhla 90112, Thailand
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #4 on:
2005-11-15 05:11:43 » |
|
As they are suspiciously computery numbers, they would appear to simply be a random shot in the dark that mostly works for most apps. Cas 
|
|
|
|
Mark Thornton
Sr. Member   Posts: 473 Medals: 2
|
 |
«
Reply #5 on:
2005-11-15 07:43:35 » |
|
That's a low starting value.
Higher values would further increase the whining about how much space Java uses. It would be nice to be able to give the gc a hint at run time to the effect that you were about to allocate ~40MB of data. In effect to override the -Xms value. I have code that allocates several hundred megabytes of data and the run time is very dependent on the minimum heap size. I understand that there are difficulties changing the maximum heap size at runtime, but surely changing the minimum size is much easier.
|
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #6 on:
2005-11-15 07:52:40 » |
|
Higher values would further increase the whining about how much space Java uses.
Nicely put  Kev
|
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #7 on:
2005-11-15 08:13:49 » |
|
I have always wished Java had the ability to specify multiple heaps, at runtime, with individual garbage collectors. Ah well. Maybe in Java 50  Cas 
|
|
|
|
Azeem Jiva
Jr. Member   Posts: 92 Medals: 1
Java VM Engineer, Sun Microsystems
|
 |
«
Reply #8 on:
2005-11-15 14:13:52 » |
|
I have always wished Java had the ability to specify multiple heaps, at runtime, with individual garbage collectors. Ah well. Maybe in Java 50  Cas  What would you do with multiple heaps?
|
|
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #9 on:
2005-11-15 15:28:39 » |
|
I'd have one heap which managed texture VRAM which would be separate to the ordinary heap, for starters. Rather than allocating memory, it only has to track memory allocation. Subtle. More enterprising and clever folk than I would probably use multiple heaps for application separation within a single VM, which would allow some seriously useful tuning of serverside applications of course. But this is a games forum and no-one cares about that except Blah^3 and Jeff  Cas 
|
|
|
|
Games published by our own members! Go get 'em!
|
|
Andrew Davison
Full Member   Posts: 120
|
 |
«
Reply #10 on:
2005-11-15 21:08:57 » |
|
I can guess an answer to my own remark about the initial allocations being small. It's to encourage multiple small garbage collections in eden space, so there's no long pauses in an application during the early stages of its execution.
The JVM will adjust itself to deal with larger size applications during execution. On Windows, the young space can increase to 5 MB and tenured to as much as 47 MB (I'm not sure on that last number).
--- As regards having multiple heaps and garbage collectors, that's already (sort of) done by using a generational heap structure, and different collectors for the young and old parts.
---- I'm on shakey ground here, but aren't textures passed over to OpenGL, and therefore beyond the reach of Java and any heap management scheme? In fact, any data managed by DLLs is outside of Java's control, and not counted as part of its heap.
- Andrew
|
Dr. Andrew Davison Dept. of Computer Engineering Prince of Songkla University, Hat Yai Songkhla 90112, Thailand
|
|
|
Andrew Davison
Full Member   Posts: 120
|
 |
«
Reply #11 on:
2005-11-15 21:29:15 » |
|
It seems like the various heap settings (and a lot more) are accessible, by using the JConsole tool in J2SE 5. JConsole gets its data from managed beans (MBeans) which monitor and manage various parts of the JVM. It's possible to write your own MBeans. There's an article on JConsole at http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html. - Andrew
|
Dr. Andrew Davison Dept. of Computer Engineering Prince of Songkla University, Hat Yai Songkhla 90112, Thailand
|
|
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #13 on:
2005-11-18 10:46:02 » |
|
What would you do with multiple heaps?
It's one of the top 5 things that professional C++ games devs in mainstream games industry cite as "things I'd need to be able to seriously develop games in java on console". IIRC, reasoning is that an awful lof of modern games mem management is ... odd ... yet entirely predictable - textures are the most obvious example. It's relatively easy to do coarse-grained mem-management at the heap level, directed by the scenegraph and/or loading of new levels (load new level => throw away your level-geometry-heap) that is more effective than a general-purpose heap manager would be, yet cost very little in programmer time. Not that I ever sent you my collated list of such things ( I need to cull down some 20 odd pages of conversations and anonymize all speakers  ), but off the top of my head the other major ones included: - ability to load an entire serialized chain of game-data (hundreds of megabytes) directly into memory, raw direct from disk, and use it immediately with no post-processing (console CPU's are slow. Console DVD-read performance is poor) More enterprising and clever folk than I would probably use multiple heaps for application separation within a single VM, which would allow some seriously useful tuning of serverside applications of course. But this is a games forum and no-one cares about that except Blah^3 and Jeff  Cas  Can you *imagine* how easy it would be to find + fix memory leaks if I could have a "grexengine heap", a "3rd party modules heap", a "JDBC driver heap" etc? 
|
malloc will be first against the wall when the revolution comes...
|
|
|
Vorax
JGO Ninja    Posts: 666 Medals: 1
System shutting down in 5..4..3...
|
 |
«
Reply #14 on:
2005-11-18 12:04:03 » |
|
Blah^3 hti it on the head - having multiple heaps would simplify things where you need large blocks of data for various purposes. I would love to allocate a block for a levels data and objects then throw it all away when done. We basically do the same thing with vertex array data now using nio and indexes into the data, but so much more could be done if we could choose to allocate objects in different memory heaps. As it is now, memory leaks in Java games are very easy to create and hard to isolate because of mixing and matching nio data with non-nio objects. Given that garbage collection/simplified memory management is supposed to be a selling point of Java for gaming, in practice it's not.
|
|
|
|
Mark Thornton
Sr. Member   Posts: 473 Medals: 2
|
 |
«
Reply #15 on:
2005-11-18 12:06:23 » |
|
One way to implement multiple heaps might be to make use of JSR 121 (Isolates). http://www.jcp.org/en/jsr/detail?id=121Each isolate would have its own heap which is discarded when the isolate completes.
|
|
|
|
|
|