LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system low on virtual memory

Hi,

I get this message sometimes when I run my program: System is low on virtual memory.... My program has two loops, and I use shift registers on these two loops. I have a loop for data array and a loop for graphing the data array. My data when put into excel is more than 1500 rows. Is it giving me error because the data arrays are big and so it runs low on virtual memory? Is there a way that I can dump this memory to a physical memory space, then read back memory and then write to Excel? Right now, the program keeps concatinate the array, then puts all that data into Excel at the end.

Thanks.
0 Kudos
Message 1 of 13
(3,073 Views)
You are running out of virtual memory, because your physical AND virtual memory are exhausted. If virtual memory is low, free physical memory will be virtually zero.

There are a few things you should do:

(1) Do a detailed analysis of your code to make sure you don't create extra data copies in memory. In LabVIEW 7.1, you can anayze the buffer allocations directly.

(2) Whenever virtual memory gets low, your OS will need to increase the swap file, taking a wild guess on how much is needed. This will repeat over and over if your data structures continue to grow. It would be better to set a large minimum size in the virtual memory configuration. This way the swap file is already at the final size, minimizing sizing operations.

(2) If your final data ha
s a know size, it is much more efficient to initialize and array with the full size (e.g. all NaN), then use "replace array subset" to insert the data as it is acquired, keeping track if the insertion point.
0 Kudos
Message 2 of 13
(3,073 Views)
Hi Ann,

You have received a lot of suggestions but no one has asked how much physical memory is in your machine.

Without knowing the detials of your app, I will say that if you are using 512M you may not have enough memory. Depending on the numbers involved, even 512M may not be enough.

Trying to help,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 13
(3,073 Views)
Hello,

As you try to improve the memory usage and performance of your VI, you might benefit from the below resources:

Optimizing VI Performance

General Performance Improvements

Hope this helps!

Liz F
National Instruments
0 Kudos
Message 4 of 13
(3,074 Views)
Hi Ben,

I have 1G so that should be sufficient for LabView, shouldn't it? I checked everywhere for closing references, so nothing is left hanging. I used a lot of property nodes, but I don't think property nodes take up memory space. I think it might be the huge array that I keep looping around through shift registers and concatinate array.

Thanks,
Ann
0 Kudos
Message 5 of 13
(3,074 Views)
There you are!

Could you post your code for us to look at?

The Enthusiasts here on the Exchange could probably nail this for you if we had something to look at.

Otherwise we will be playing a game of 50 questions and may still not get there.

I will watch for your posting!

By the way, is that 1G of physical or Virtual memory?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 13
(3,074 Views)
Adding to the above....

You may be correct re:the array but with visual aides we may be able to suggest cleaner appraoches.

This reminds me of one of Rolf K's quotes which was,

"Once your physical memory is used up by a single shift register storage, your application is probably going to ..." Rolf Kalbermatter Info-LabVIEW 3 December 2002.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 13
(3,074 Views)
My code is very big so it will be a little bit inconvenience to send it. I have a lot of sub-VI, my computer has 126 MB of RAM, 192 MB of visual aid, and 10 GB of hard drive, but only 1.46 GB is available. My program is a main program that calls sub-VIs to do tests. When my input is 1/3 of the original, then I don't have any problem. But when I put it a full input, after the program finishes running, the computer runs very slow. Is this also because of virtual memory? Thanks.
0 Kudos
Message 8 of 13
(3,074 Views)
OK.

Now thing make sense!

To justify my following suggestion, I would like to first digress a little.

Modern OS's allow you to run programs that require more memory than the computer actually has. When I used the term "memory than the computer actually has" I am talking about physical memory. These are physical devices (typically sticks) that store your programs and the data.

When the OS (operating system) determines that a program is requesting more memory than can be stored in the physical memory, it starts to play tricks on you and provides additional storage by using Virtual memory. It is called Virtual because it is not real (i.e. physical) memory.

So how does it create Virtual memory if it is not physical? It allocates space on your hard drive that holds the data that would have been in physical memory if it was available and then it starts a complicated series of tricks to fool the program into thinking it has all of the memory that it needs.

The OS will then set up some "traps" that will allert it when the program is trying to read some of the memory that it thinks it has but in actuallity is on disk. When one of these traps "goes off" your program will be suspended by the OS and then the OS will go read the data from disk and copy it into physical memory. It will then re-start the program (right where it left off) and everything proceeds as if the "tricks" never happened.

The above is a brief explanation. A full explanation is beyond me and is subject to change with every OS upgrade.

Well I miss-lead you slightly in the above because there are some important differences in Virtual Memory and Physical.

THe first big difference is speed. Code resident in physical memory takes only nano-seconds to respond to a read or write attempt. Virtual memory is much slower. It has to wait on disk drives to read data etc.

You may have noticed that when you were running the scaled down version of your code that the application was probably more responsive.

The other differences are not important right now.

So...
Your running out of Virtual memory is probably becuase you do not have anymore space on your hard drive to be used as vitual memory. A larger hard drive may help with your warning messages.

If you need your application to run faster (after you have eliminated the virtual memory issues) then more physical memory is called for.

So...
Start by using "Task Manager >>> Performance" to see what your memory usage is durring run time. If possible, upgrade your memory so you are using physical memory only.

Well I realize that I have been rambling a bit so I should stop here.

So...
You probably need more physical memory.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 13
(3,074 Views)
You said:
...I think it might be the huge array that I keep looping around through shift registers and concatinate array...

The combination of "huge array" and "concatenation" is a recipe for memory waste via fragmentation. I would have to second altenbach's suggestion to preallocate your huge array and then update values using "Replace Array Subset" instead of concatenation. I also second his suggestion to look for buffer copies you can eliminate.

Ben's advice to add physical memory may also help, but don't neglect the othe
r things you can do to use the memory you've got more efficiently.

Good luck!

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 10 of 13
(3,074 Views)