View Single Post
  #13   Spotlight this post!  
Unread 18-03-2016, 13:44
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: WPILIB Camera Code Crashing JVM

Quote:
Originally Posted by adamzg View Post
We originally had Image as a class variable, but after looking at how it was used we made it local. Image is used to allocate memory for the native call way down the line so having it as a member variable leads to concerns about not being able to release the memory, thus the finally block. Having it as a member variable could potentially result in a memory leak which would first hurt performance and could ultimately crash the program with an out of memory exception.

We flashed all our roboRIOs this year, what makes you think it's last years Java version? I'll check on our end to make sure the RIOs are all running build 1.8.0_06-b23, I don't think they would work at all if we hadn't flashed them. Can you post a link or provide info. on why you think the JVM version is wrong and where/how we'd get the right one?

Thanks for your help!
Why do you have to create a new image every time you do a getImage? You can pre-allocate it one time as a class variable and just keep re-using the same created image buffer. That's how we did it in our code. Actually, since we are using a separate thread for processing the image, we pre-allocated two image buffers so when one thread is accessing the image, the other thread won't overwrite it with a fresh image. We just atomically swap the buffers when a new image is available.
__________________
Reply With Quote