LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Premature Memory full at 300 MB

Hi

Memory issues with Labview is legion. We all know you can easily get trapped in the cloning of data inside a VI or when calling sub-vi's.

I used to work on a project with large user data under 7.1/ XP professional and trip at around 1.2 GB of virtual memory (as verified by the windows task manager)

Now I'm am doing a large distributed project on LV8.5.1/XP and compact field point that drives me crazy because of it's very erratic Labview crashes usually with a runtime error in a cpp routine.

 

Moving the whole project to 8.6 has given some errors indicating a memory problem. I verified again with the task manger and got something around 300MB. All this without much user data.

 

With my previous experience of a 1200 MB limit I tried to run the usual "append to array"  in a while loop and got stopped also around 300MB.

 

I am running a normal Win XP/professional and have recently de-fragmented the swap file. 

 

Is there anything else I could do to provide enough contigous memory (assuming this is the issue) ?

 

Thanks for any opinions

 

Gabi

7.1 -- 2013
CLA
0 Kudos
Message 1 of 5
(3,165 Views)

The best solution for something like this is usually to fragment the data structure yourself so that you have many small elements (e.g. queue elements) instead of one large structure (e.g. an array). Also, you want to avoid doing repeated memory allocation (e.g. the append in a loop you mentioned) and be aware that memory copies don't occur only in subVIs.

 

If you're getting cpp errors, however, you might wish to open a support request and try tracking it down officially, as that's most likely a bug.


___________________
Try to take over the world!
Message 2 of 5
(3,152 Views)

Thanks, tst, for your ideas

 

I did some further investigations and indeed one loop of "append to array" gives a "memory full" at much smaller total used number than two or three in parallel. What does shock me is that not my user program gives the problem (as far as I can see). There are no huge data structures or so. It is the Labview environment, that crashes, sometimes when you simply move an item on the diagram.

 

Related is this apparently to the fact that I have two portions in the project. If I stick to the PC side it is behaving, if I open the Fieldpoint on top, that seems to be too much.

 

By now I found out that since LV 8.2.1 the /3GB large address-space is possible. So I changed my boot.ini and we'll see how it's going on.

 

Fact is that either Labview or Windows  or the two together do a very bad job in managing memory. Not nice, not at all.

 

Thanks, Gabi

 

7.1 -- 2013
CLA
0 Kudos
Message 3 of 5
(3,114 Views)

If you haven't already done so, I recommend reading the tutorial Managing Large Data Sets in LabVIEW.  LabVIEW requires a contiguous memory space for each array.  In LabVIEW 7.1, the amount of code and positioning of the DLLs in memory allowed you to allocate a contingous space of about 1.2GBytes.  IN LabVIEW 8.0, this was reduced to about 800MBytes due to new DLLs for added functionality.  Adding anything else (e.g. TestStand) can easily reduce this further.

 

In addition, Append to Array in the worst case scenario will attempt to create a new continguous memory space every time it is used, creating highly fragmented memory. The solution is to preallocate arrays (use Initialize Array or the autoindex output of a FOR loop).  Fill the preallocated arrays using Replace Array Subset.  If you need to grow the array, use Reshape Array. By doing this, you take active control of the memory management of the arrays instead of letting LabVIEW handle it for you.

 

As tst said, you can use fragmented memory by allocating your data in multiple arrays to allow LabVIEW to use discontinuous sections of memory.  You may want to create a LabVIEW object to manage the details so you can ignore them in day to day programming.

 

If you can post code which reproduces the cpp crash you are seeing, we would appreciate it so we can debug it.  Let us know if you need more help.

Message 4 of 5
(3,104 Views)

Gabi Tillmann wrote:

Thanks, tst, for your ideas

 

I did some further investigations and indeed one loop of "append to array" gives a "memory full" at much smaller total used number than two or three in parallel. What does shock me is that not my user program gives the problem (as far as I can see). There are no huge data structures or so. It is the Labview environment, that crashes, sometimes when you simply move an item on the diagram.

 

Related is this apparently to the fact that I have two portions in the project. If I stick to the PC side it is behaving, if I open the Fieldpoint on top, that seems to be too much.

 

By now I found out that since LV 8.2.1 the /3GB large address-space is possible. So I changed my boot.ini and we'll see how it's going on.

 

Fact is that either Labview or Windows  or the two together do a very bad job in managing memory. Not nice, not at all.

 

Thanks, Gabi

 


Are you using Strict Type Definitions?

 

Otherwise check with support re the cpp number to see if this bug has been fixed in LV 8.5 or above.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(3,100 Views)