Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  What are the Default Heap Sizes?  (Read 3974 times)
0 Members and 1 Guest are viewing this topic.
Offline Andrew Davison

Junior Member


Medals: 2



« Posted 2005-11-15 03: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
Offline Azeem Jiva

Junior Member




Java VM Engineer, Sun Microsystems


« Reply #1 - Posted 2005-11-15 04: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

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #2 - Posted 2005-11-15 04:36:29 »

+1 for making the current values for these things accessible via a runtime property.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andrew Davison

Junior Member


Medals: 2



« Reply #3 - Posted 2005-11-15 08: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
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2005-11-15 11: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 Smiley

Offline Mark Thornton

Senior Member





« Reply #5 - Posted 2005-11-15 13: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.
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #6 - Posted 2005-11-15 13:52:40 »

Quote
Higher values would further increase the whining about how much space Java uses.

Nicely put Smiley

Kev

Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2005-11-15 14: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 Cheesy


Cas Smiley

Offline Azeem Jiva

Junior Member




Java VM Engineer, Sun Microsystems


« Reply #8 - Posted 2005-11-15 20: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 Cheesy


Cas Smiley

What would you do with multiple heaps?
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2005-11-15 21: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 Smiley

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andrew Davison

Junior Member


Medals: 2



« Reply #10 - Posted 2005-11-16 03: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
Offline Andrew Davison

Junior Member


Medals: 2



« Reply #11 - Posted 2005-11-16 03: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
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #12 - Posted 2005-11-18 05:39:27 »

FYI: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6233917

This bug will be fixed in beta.

Thanks,
Dmitri
Java2D Team
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #13 - Posted 2005-11-18 16: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 Sad ), 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 Smiley

Cas Smiley

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? Wink

malloc will be first against the wall when the revolution comes...
Offline Vorax

Senior Member


Projects: 1


System shutting down in 5..4..3...


« Reply #14 - Posted 2005-11-18 18: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.

Offline Mark Thornton

Senior Member





« Reply #15 - Posted 2005-11-18 18: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=121

Each isolate would have its own heap which is discarded when the isolate completes.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (50 views)
2014-04-15 18:08:23

BurntPizza (46 views)
2014-04-15 03:46:01

UprightPath (62 views)
2014-04-14 17:39:50

UprightPath (44 views)
2014-04-14 17:35:47

Porlus (61 views)
2014-04-14 15:48:38

tom_mai78101 (84 views)
2014-04-10 04:04:31

BurntPizza (142 views)
2014-04-08 23:06:04

tom_mai78101 (242 views)
2014-04-05 13:34:39

trollwarrior1 (201 views)
2014-04-04 12:06:45

CJLetsGame (208 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!