I often experience "java heap memory space" insufficient errors when playing large maps like RSOC or Civil War. Incidentally, this never happens when Civil War is loaded locally, only when it is loaded on an internet game.
I looked up the "java heap" memory error and found that it could have one of two causes:
1) The program has a memory leak, does not discard objects normally but instead accumulates a pile of trash which becomes a drag on the memory.
2) The program really does consume that much memory and an insufficient amount of memory is allocated to it.
So the question is, do we have a memory leak issue, and how do we fix it? And if it really does need that much memory to play large maps, is there a way to allocate a significantly larger chunk of memory to TripleA? Is this governed by something in the code itself?
...and I know the few active maintainers we have need a well-deserved break after this latest stable.
I have access to some profilers that I'll run the engine through. I'm sure we have at least a couple of processes that are in deed leaking.... but they're not used often. I'll try to incorporate any changes into the next unstable.
If emailing me at ComradeKev at yahoo.com , please add TripleA to the subject line
So i've ruled out that its a memory allocation problem.
I ran TripleA from terminal with 2gb of RAM: java -Xmx2000m -jar triplea.jar
...and I get the same problem upon startup of the map. Basically the map tiles fail to load and the map is blank. I can still scroll around, I can still open up the side tabs and history tabs, its just that the map is a sea of light gray.
And, this problem only occurs when I am in a network game with somebody else hosting. It doesn't happen in a local game against AI.
So the question is, is this something wrong with running TripleA in general or just something wrong with my computer? Initially i thought it might have been a memory leak but after testing it like this it no longer seems to be so.
For reference, this is the error:
Exception in thread "Map panel background drawer" java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.lang.Class.getDeclaredMethods0(Native Method)
EDIT: FYI I am running Java 6 Update 17 for Mac OS X 10.6.2
Unfortunately at my current location, I can't host for quite a while. Spent all day yesterday trying to port forward my router -- ostensibly it is port forwarded yet it keeps saying my laptop is not reachable from the internet.
Sean, I have had the exact same problem as puli has been describing. I'm on OS X 10.4.11 with a 13 inch screen. I get the upon opening RSOC which definitely means it isn't because of a long game. RSOC is 9MB, NWO is 7MB, TRS is 11 MB. I have run NWO and TRS games up to 15 rounds without error, so it certainly isn't the map size that's the problem. It seems to be much more mysterious.
I just wish to do some comparisons, so that maybe we can figure out what or why Civil_War is causing my computer, and puli's, to crash (only crashes when attempting to host).
I have a 10 year old laptop.
it is only a 1.4gz old single core
with 500mb of ram
and an old nvidia 440go video card with only 64mb or ram on it (i think?)
and I'm running windows xp sp3, with antivirus, firewall, sql host, sql writer, office suite, oracle, and a whole ton of other crap that i need to get rid of (basically, i'm saying i have a high start up memory usage of about 320mb in pagefile)
oh, and my screen resolution is 1600x1200 with max 32bit colors (am i crazy? why do new laptops have a smaller resolution than me? why do hdtv's have a smaller resolution than a 10 year old laptop? suckers!)
i can host every map in the world except pulicat's map
I can run and host Domination, Galaxy, NWO, and other crazy big maps
here are some comparisons between pulicat's map, and Domination
basetiles are 560kb
relieftiles are 11000kb
size of XML is 540kb
number of units on the map at startup: huge number!
Civil War by pulicat
basetiles are 550kb
there are no relief tiles
size of XML is 520kb
number of units ont he map at startup: small number
by all comparisons, Domination is bigger and harder on my computer in every way. It is almost twice as big.
so why is Civil_War giving me an out of heap-memory error when i try to host games?
(but i can host domination fine)
(i tried hosting a game, with just myself, noone else allowed in, and I crashed. but i can play locally just fine)
I'll keep looking at the xml and polygons file and stuff... who knows
sgb, kev.... i posted it on the downloads list if you want to easily download it and have a look too
1) it could be that maps that have lots of single placement (single entry in placement.txt) use up a lot of memory.... perhaps TripleA has a very inefficient way of putting the next unit with a black line next to the last placement?
3) really big decoration files?
4) high territory density? (of course, other maps have more territories, like diplomacy has many more on screen at once because of the dummies and i do notice a slowdown because of it, but not that much)
5) large polygon file? the poly file is 2mb, which slightly smaller than domination, but domination is also twice as big a map... i dunno
6) Pulicat, destroyer of threads, eater of memory?
7) NOs or other v3/aa50 rules aspects/properties are hard on the computer?
possible debugging to do pulicat:
a) make sure the place.txt has at least 3 entries/coordinates for each territory
b) temporarily remove decorations
c) try commenting out certain parts of code and seeing if it clears things up. like for example, commenting out all railroads.
I got this error when trying to start the Civil War map posted on the Depot:
java.lang.IllegalStateException: Could not load misc/unitchart.png
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Does this just happen for me, or does it happen for everyone?
By the way, I restarted before starting so that shouldn't be causing it.
Can confirm Bung's find: Use of Battlecalc slows games down up to a freeze, within 1-2 rounds. Specifically on a fast (i5) machine, Windows7, NWO (host and guest), and the worse the further the game progesses.
Others report too that trouble seems to affect Windows7 specifically. Java memory usage increased by that time significantly (~200MB to ~250MB a round further), but not enough to explain the crawl at all (6GB machine).
All pretty unspecific info, I know, but best I can provide. Maybe it helps.
When I devour this planet, I'd like a TripleA without this as a topping, tastier.