View Single Post
  #14   Spotlight this post!  
Unread 21-03-2016, 12:13
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 321
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: WPILIB Camera Code Crashing JVM

Quote:
Originally Posted by pblankenbaker View Post
I'm not really sure if calling free() is required on image objects (in Java you would hope that resources would be automatically freed by the garbage collector), I just know that our problem went away once we started invoking free().
The way native libraries work in Java is usually that you must call some sort of cleanup method manually. The garbage collector will clean up java objects, but not memory from native libraries and as you know, C(++) does not have a garbage collector.

(there must be a good reason that wpilib isn't using finalize() to call free() - maybe finalize is unreliable?)

Anyway, I have to go with the previously stated recommendation, that you reuse the same image object. NI vision allows you to do that.
Reply With Quote