Linked by ebasconp on Fri 10th Jun 2011 22:22 UTC
Thread beginning with comment 477082
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[8]: Results are Implementation dependent
by pantheraleo on Mon 13th Jun 2011 18:01
in reply to "RE[7]: Results are Implementation dependent"
A popular Java program these days is Minecraft. I love it myself. But it has cases where, when memory consumption hits 700 MB or so, the game gets insanely choppy. This is the garbage collection happening. It sucks. It's unusable.
That sounds like bad programming to me. Probably excessive object creation, which could likely be found and fixed with a profiler actually.
I've done a fair amount of Java3D programming myself, and don't have this problem with things I have written.
Also, this problem is not unique to Java. I've seen C++ games that have similar problems for the same reason. Excessive object creation. Without careful planning, that's an easy trap to fall into in any object oriented language when doing game development with it.
A whole gigabyte, to hold a chunk of active blocks which, if stored in a well-thought out C++ data structure, would only take a hundred megabytes or so.
See what I said above. The exact same thing is true in Java. A well-thought out data structure in Java could avoid this problem. Don't blame Java for bad programming technique on the part of the developer. You could get yourself into the exact same trouble with C++ if you naively used a separate object to hold each block, and then ended up with excessive object creation because of it. This is bad programming technique. Not the fault of Java.
Edited 2011-06-13 18:04 UTC
RE[9]: Results are Implementation dependent
by zlynx on Mon 13th Jun 2011 18:44
in reply to "RE[8]: Results are Implementation dependent"
It seems to me that most of the fixes for slow, choppy garbage collection and excessive memory usage in Java are to avoid using the memory allocator. Allocating an array of objects and reusing them, for example. Or discarding and creating a whole new array instead of one object at a time.
This is almost exactly the equivalent of using a pool allocator in C++.
So it always strikes me that to write really efficient Java the programmer has to do as much work as in C++ and sacrifices the easy programming Java is supposed to offer.





Member since:
2005-07-20
A little more speed? A little less memory consumption?
A popular Java program these days is Minecraft. I love it myself. But it has cases where, when memory consumption hits 700 MB or so, the game gets insanely choppy. This is the garbage collection happening. It sucks. It's unusable.
To fix it, the recommendation is to run the 64-bit server JVM and let it use a gigabyte of RAM.
A whole gigabyte, to hold a chunk of active blocks which, if stored in a well-thought out C++ data structure, would only take a hundred megabytes or so.