View Single Post
  #2   Spotlight this post!  
Unread 25-02-2010, 08:29
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: crio/java out of memory error

This is actually an "out of C memory" error, not out of Java memory error. So garbage collection is not an issue.

I'm guessing that you are calling DriverStationLCD.updateLCD() fairly frequently. This shouldn't be a problem, except there's a memory leak in FRCControl.setUserDsLcdData().

You can try this fix (open the project sunspotfrcsdk/lib/WPILibJ in NetBeans)

And use this new method implementation:
Quote:
public static void setUserDsLcdData(byte[] bytes, int length, int timeOut) {
Pointer textPtr = new Pointer(bytes.length);
textPtr.setBytes(0, bytes, 0, bytes.length);
setUserDsLcdDataFn.call3(textPtr, length, timeOut);
textPtr.free(); // free c memory
}
FYI - there are similar bugs in the Visa class used by the SerialPort class.

Last edited by derekwhite : 25-02-2010 at 08:32.
Reply With Quote