|
No robot code after running for a while (Java VM ran out of memory)
During practice, our drivers complained that after running the robot for a while, the robot would disconnect and said "No Robot Code" until we reboot the RoboRIO, couldn't even "Restart Code", must do a RoboRIO reboot. I finally looked into the problem and found out the Java VM ran out of memory.
This is the first year our team switched over to Java. We used C++ in previous years. We have a C++ library that we ported over to Java. One of the modules is Vision Targeting. I suspect this module is "leaking memory". In our C++ implementation, we allocated memory for processing the video frame and freed it when we are done with the frame. But in Java, there is no "free memory" because Java relies on the garbage collector to reclaim memory. I suspect the reclaim process is not immediate and depends on if the Java VM can detect the memory is no longer in use. So if we are processing video frames at some frame rate, we are losing memory on the video frame at frame rate. That could be substantiate after a while. How would one deal with this kind of issues? Sorry if this is a naïve question, we are new to Java.
__________________
|