lxx.Tomcat 3.55 vs cs.ags.Scarlet 1.1c
The highlighted comment was created in this revision.
The duels between lxx.Tomcat 3.55 and cs.ags.Scarlet 1.1c are throwing OutOfMemoryErrors and crashing my clients.
I´m using the standard -Xmx512m parameter in a 64-bit Hotspot JVM (Oracle/Sun).
It's strange - i have no problems in same environment: java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
Can you do some more investigations (Tomcat vs Druss & Scarlet vs Druss etc. and see in which battles memory usage will higher) to detect which robot is eats memory and, if it's Tomcat. i will try to fix it
Scarlet uses lots of memory. The longer the battle the more memory used. So battles against top bots will use the most.
Made some tests. I set -Xmx2g, tested the pairings below twice each and tracked how much memory the JVM allocates:
Tomcat vs Scarlet: 1,231,648k, 1,133,508k
DrussGT vs Tomcat: 1,047,452k, 1,043,268k
DrussGT vs Scarlet: 1,251,568k, 1,221,012k
DrussGT vs Diamond: 869,356k, 878,216k
Those numbers are maximum heaps. The actual used heaps are usually between 30% to 70% of those numbers.
So it seems both Tomcat and Scarlet use a lot of memory... hmm. I can see how a battle of one vs the other could cause problems on a memory limited machine. What are the maximum heaps used when run with -Xmx512MB ?
The reason Scarlet uses so much memory is it is just two bots that have been welded together. Each side manages its own information and systems.
I also do some investigations:
- Tomcat 3.54a vs Tomcat 3.54a: ~320 mb
- Scarlet 1.1c vs Scarlet 1.1c: ~300 mb
- Druss vs Druss: ~129 mb
- Diamond vs Diamond: ~116 mb
Numbers - it's smallest used memory showed by robocode after gc. So both Tomcat & Scarlet is memory consuming robots. I tried to optimise Tomcat, but did not get any success. Anybody have ideas, how i can detect which part of Tomcat uses most part of memory?
Are you using fasttrig? If so, how big are your arrays?
Are you using multi-dimensional arrays? It is very easy to use LOTS of memory. I have many multi-dimensional arrays, but use a lazy initialisation so that memory is only used if it gets written to first.
If you have your own kd-tree, check that it is splitting how you want it to. If it only splits one point off each time, it will get deep very quickly. This uses lots of memory, as each object needs a container and a bounding box.
Check if you have static arrays/lists that could initialised after each round.
Don't keep logs of data that won't get used again. Once it won't be used (eg at the end of the round) clear it explicitly by setting to null or calling .clear()
Check you don't have circular dependencies. Make sure you break the dependency if you delete something.
These are my first thoughts =)