View Single Post
  #1   Spotlight this post!  
Unread 10-03-2016, 09:30
adamzg adamzg is offline
Mentor
AKA: Adam
FRC #3932 (Dirty Mechanics)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Boynton Beach, FL
Posts: 16
adamzg is an unknown quantity at this point
Re: WPILIB Camera Code Crashing JVM

Looking at the source for NIVision I think the .free() will work if used in a finally block. When we tried it the first time it didn't end up in a finally block and the image was being used as a member variable.

The NIVision class is calling C libraries that allocate memory outside the JVM so the correct steps we need are (pseudo code):
  • Image image;
  • try
  • allocate image - image = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_ RGB, 0);
  • use image - CameraServer.getInstance().setImage(image);
  • finally
  • free image - image.free();

Will repost when we understand better.
Reply With Quote