View Single Post
  #2   Spotlight this post!  
Unread 14-02-2013, 06:06
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Java, WPI, Image Processing, and OMG I got a memory leak...

You may not be running into a memory leak, but instead memory fragmentation. To minimize the number of (re)allocations done, you can try something like this:
Code:
// Inside the class, outside of any methods
Image image = new RGBImage();
BinaryImage bin = new BinaryImage();
Then later:
Code:
camera.getImage(image);
NIVision.colorThreshold(bin.image, image.image, ... );
// Other processing ...
__________________
I code stuff.
Reply With Quote