View Single Post
  #6   Spotlight this post!  
Unread 07-11-2016, 23:32
cnc4 cnc4 is offline
Registered User
FRC #2231
 
Join Date: Jul 2016
Location: Israel
Posts: 8
cnc4 is an unknown quantity at this point
Re: Getting axisCamera image result in an exception somtimes

Quote:
Originally Posted by mikets View Post
My understanding of the NIVision code is that it's actually written in C++ natively and have a Java wrapper. Because of this, the Java garbage collector doesn't reclaim image buffers allocated by NIVision API. Therefore, if you allocate image buffer for every frame, you are going to run out of memory really fast if you don't explicitly release the buffer after it's done. There are a lot of discussion threads about this issue, you can probably find and read them in the forums here. There are two ways to fix this. You can either rewrite the code so it doesn't allocate a new image buffer on every frame you process (we rewrote our code that only uses two preallocated frame buffers), or you will need to call image.free() when you are done with the buffer (Please note that I don't have the NIVision documentation in front of me so the actual API name may be different).
But the main issue is that I get an unkown exception. You thinks that the exception is cused by outOfBufferException in the native method?

Quote:
Originally Posted by euhlmann View Post
Take screenshots please

So it's more than an undocumented error code, it seems WPILib is actually using NIVision black magic with a "private" function that's completely undocumented. You might be better off opening an issue on the WPILib repo. I can't help without documentation or source code
I would of take screenshots but I did't had the computer neer me .

Ammm... so it never happend to other teams? No one ever reported this issue?
Reply With Quote