|
Re: No robot code after running for a while (Java VM ran out of memory)
When the Java VM detects that it is running out of memory, the garbage collector should start trying as hard as it can to destroy unused objects, preventing you from running out of memory. You should make sure you are not somehow retaining a reference to old objects, preventing them from being garbage collected. It may also be that you are allocating memory too fast for the garbage collector to handle it, but I'm not sure if this is possible.
Another recommendation I have is that you try to reuse objects as much as possible between frames. Memory allocation is a fairly expensive operation. Especially in Java, since you cannot explicitly destruct objects, when you construct large objects in a fast loop, the garbage collector has to work very hard to destroy them, which can slow down your program.
__________________
2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
|