LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting "Memory is Full" error

I am collecting large amounts of data from an Acqiris AP235 PCI card (basically an 8-bit digitizer with firmware for on-board analysis). The card is in a computer with an Intel Core2 (aka Core2 Duo) 6600 and 2 GB of ram running WINXP Pro. Before initializing the array to accept the data, Windows task manager reports 2.096 GB physical memory with 1.699 GB available (0.447 GB devoted to system cache). When I initialize the array for 2000 x 401600 bytes, all is well and the available memory drops to about 0.913 GB (system cache essentially unchanged). However, if I initialize the array for 2100 x 401500 bytes, which should be only an extra 0.04 GB, I get an error telling me that the memory is full. I have used the Labview profile feature to check that I am not making multiple copies of the array. Why am I getting this error and is there anyway to make use of the "available" memory?
 
Any help would be appreciated.
 
Tom
0 Kudos
Message 1 of 3
(2,958 Views)
Tom,

This is actually a Windows limitation. In order to initialize a large array, we need to have not only that memory free, but a contiguous block of that size.  If it's broken into chunks, we can't place an array that spans chunks.  You can witness this by making a VI that allocates and deallocates increasingly large arrays - this will cause new memory to be allocated since it won't fit into the old spot.   Eventually, you'll receive a memory full error, despite having the total sum of memory availble.  Unfortunately, this behavior spans from the way Windows handles memory, and not from LabVIEW.

You can see a more detailed discussion here:
http://www.ittvis.com/services/techtip.asp?ttid=3346

To work around this, you should
1) Avoid initializing data chunks of this size more than once in a session of LabVIEW. 
2) If you must, initalize the largest block FIRST, then subsequent arrays would fill the gap left behind the largest block.  You will notice if you try your test in reverse -- intialize the larger array first then the smaller one, you probably will not receive the error.
3) Try using several smaller arrays instead of one huge one.

Since memory fragmentation is by process, you can reset the fragmentation for the process by restarting LabVIEW.
Hope the helps.
--Paul Mandeltort
Automotive and Industrial Communications Product Marketing
Message 2 of 3
(2,926 Views)

Paul,

Thanks for the description and the link - very useful. I had come to the conclusion that it was a memory fragmenation problem when I found that if I initialized an even larger array at the very beginning of the vi and then resized it as needed later, I was able to use much more memory. But I think that using multiple smaller arrays may be a better way to handle it.

Thanks again.

Tom Whitaker

0 Kudos
Message 3 of 3
(2,909 Views)