After we are done processing an image from the camera, we use the .free() method. However, on the driver station, under the charts tab, the available RAM for the cRIO always decreases with each picture, but never increases to it’s previous level. This leads to us running out of memory and unable to take anymore pictures until we reboot the cRIO. We have moved the variables from the method to the class. We believe we are not saving any references to the image. We have released the underlying pointers. However, the problem remains. Has anyone else encountered this problem and if so, how have you resolved the issue?
For efficiency, all the images in Java are stored as opaque C data structures and have to be explicitly freed. I know you said that you are calling free() in your code, can you make sure that all the intermediate images are also freed?
If it turns out that you are doing that, maybe you could start cutting out some of the vision primitives to see which one is leaking the memory. You could do this by just commenting the code and rechecking. It won’t work since the program is getting chopped up, but you can test for the leak.
It’s possible that there is a bug in one of the methods and the library is leaking somewhere. This would help isolate that, and we can patch it for you.
Thanks,
Brad