Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   crio/java out of memory error (http://www.chiefdelphi.com/forums/showthread.php?t=83570)

LeelandS 24-02-2010 20:12

crio/java out of memory error
 
Hi, when we leave our robot running for a relatively long period of time we get an error message related to running out of memory.

We added this code to print the free memory:

try {
Thread.sleep(500);
} catch ( InterruptedException e ) {

}
System.out.println("free mem" + GC.freeMemory());

[cRIO] free mem6677012
[cRIO] free mem6519896
[cRIO] free mem6364744
[cRIO] free mem6208284
[cRIO] free mem7687544
[cRIO] free mem7531060
[cRIO] free mem7373272
[cRIO] free mem7217988
[cRIO] free mem7061888
[cRIO] free mem6906812
[cRIO] free mem6752432
[cRIO] free mem6596116
[cRIO] free mem6440184
[cRIO] free mem6284224
[cRIO] free mem7764512
[cRIO] free mem7609052
[cRIO] free mem7453716
[cRIO] free mem7296632
[cRIO] free mem7140484
[cRIO] free mem6983784
[cRIO] free mem6827748
[cRIO] free mem6671184
[cRIO] free mem6516512
[cRIO] free mem6360892
[cRIO] free mem6206844
[cRIO] free mem7691412
[cRIO] free mem7536352
[cRIO] free mem7379612
[cRIO] free mem7223060
[cRIO] free mem7068420
[cRIO] free mem6913356
[cRIO] free mem6757728
[cRIO] free mem6601696
[cRIO] free mem6446328
[cRIO] free mem6291460
[cRIO] free mem7766200
[cRIO] free mem7610576
[cRIO] free mem7455504
[cRIO] free mem7300268
[cRIO] free mem7146560
[cRIO] free mem6990720
[cRIO] free mem6835784
[cRIO] free mem6679188
[cRIO] free mem6522128
[cRIO] free mem6366176
[cRIO] free mem6212340
[cRIO] free mem7692888
[cRIO] free mem7537672
[cRIO] free mem7382384
[cRIO] free mem7226732
[cRIO] free mem7071068
[cRIO] free mem6914580
[cRIO] free mem6759276
[cRIO] free mem6602544
[cRIO] free mem6448012
[cRIO] 0x214fdd8 (SquawkRobotTask): memPartAlloc: block too big 128 bytes (0x8 aligned) in partition 0x417470
[cRIO] Uncaught out of memory error on thread - aborting isolate Thread-9
[cRIO] Tried to execute callbacks in the context of an isolate that is no longer alive: isolate 1 "SparX.SparX" (EXITED)
[cRIO] Skipping that set of callbacks
[cRIO]
[cRIO]
[cRIO] --------------------------------------------------------------------
[cRIO] GCs: 1 full, 90 partial
[cRIO] ** VM stopped: exit code = 999 **
[cRIO] task 0x214fdd8 (SquawkRobotTask) deleted: errno=0 (0) status=999 (0x3e7)


The memory seems to look ok up until the error. The garbage collections are pretty obvious and the freemem just moves between 6000000 and 7000000. The log above is very abreviated.

Any ideas to further debug this?

derekwhite 25-02-2010 08:29

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.

LeelandS 25-02-2010 11:18

Re: crio/java out of memory error
 
Thank you so much!

We suspected the C side and had removed the camera code. We didn't realize the driver station code had similar implications.


All times are GMT -5. The time now is 09:27.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi