Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory usage Crio

I have a "small" problem with my Crio 9004 controller.
I have to load some big files into an array. Files are stored as binary files.
When i load too much files and start my simulation memory usage becomes 100% and my app crashes.
This is like i expected.
But when i restart my application the memory is still full.
In the attached file 1 marks the position my app crashes and 2 the usage after i restart my application.
 
Is there a possibility to free this memory without restarting the crio?
 
Best regards
Thomas
0 Kudos
Message 1 of 4
(3,673 Views)
Hello Thomas,

after not ending the Vi in normal manner, the system has to be rebootet to free the memory.

Best regards

D.Ackermann


D. Ackermann
Applications Engineer
National Instruments Germany
0 Kudos
Message 2 of 4
(3,650 Views)
I'm not sure about the behaviour of the simulator (I haven't used it), but the cRIO itself needs contiguous memory when it allocates an array.  So if the second run asks for an array bigger than the first run, it can't reuse the memory from the first run and there isn't another contiguous block of memory anymore that big that is available so it crashes.  It never seems to really release the memory.  I don't know if this is my fault or not, but it just never seems to let go of it once it's got it.  So preallocate the array to the biggest possible size the first time, then the second run is sure to fit the same spot.  My application repeatedly uses an array that is up to 400k samples X 2 bytes sample X 16 channels (12.8 MB) per acquistion cycle.  But if I don't preallocate it to the biggest size first, it always crashes out of memory on the second or third cycle.
0 Kudos
Message 3 of 4
(3,639 Views)
Yes, memory has to be preallocated. Always preallocate the maximum size you think you need for your task.

See also link to Real Time Module Help:
http://zone.ni.com/reference/en-XX/help/370622C-01/lvrtconcepts/avoidcontmemrt/

Best regards
D. Ackermann
Applications Engineer
National Instruments Germany
0 Kudos
Message 4 of 4
(3,620 Views)