LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear labview memory

Solved!
Go to solution

I'm working on a data visulization program that visualizes data in different plots and performs some post processing like noise reduction etc. The data file is about 100 M large, generated by "write to binary file" of clusters and arrays. The visulization program is contructured in a "state machine" fashion. It first reads the data, then passes the data to shift registers for different data processings, depending on which tab is clicked on front panel.  My problem is, first it takes about 1G memory after reading the 100 M data file. Second, after I run multiple times (for loading different data files) the memory keeps growing and eventually crashes the program.  Is there a way for better memory allocation, and clear the previous data after I load a different data file? Attached is a simplied program, in which I deleted most of the data processing diagrams. Thanks!

0 Kudos
Message 1 of 6
(18,216 Views)

First of all, there doesn't seem to be any small waits anywhere. In some of the states you are polling like crazy.

 

Why do you split the data into 5 near identical shift registers, then filter two each with the same exact parameters. Isn't that a lot of duplication of effort and data? Why do you write the same value over and over to an indicator in the innermost loops? That belongs outside the loop! If you would use an event structure or some other vlaue changed detection in state 3 (hint: feedback node), you wouldn't even need these hidden indicators.

 

Where is the bulk of the data? (in the 2D arrays of cluster, the 1D array, the 2D array, etc.?

 

What is happening in state 3? You seem to have a lot of duplicate cases in the case structure. Why do you need to recalculate the inner FOR loop and enything else as fast as the computer allows. Nothing ever changes!

 

Why don't you keep only one shift register and filter on demand?

0 Kudos
Message 2 of 6
(18,205 Views)

Sorry on the confusion. This is an example VI in which I deleted most of the original diagrams. The following is my clarification.

1) 5 near identical shift registers are wired together only for convenience purpose, they are actually different in my original diagram. 

2) Indicators are subjectt to change in real time as a result of actions in the front panel, e.g.move the mouse and find line cut from an intensity graph.

3) the bulk of data is from the hard disk, as you can see in case 0.

4) Cases in state 3 are not duplicates, they serve for different purposes and only one case will be executed depends on front panel action (by clicking which tab to display). Again, I deleted all the sub diagrams in this case structures for viewing purposes.

 

Anyway, running this program won't increase memory in real time. However, if run this program repeatedly after reading different data file on hard disk, the memory grows and eventually crashes. My question here is how to clear memory from previous data files. And why loading 100M binary file from hard disk will take 1 G memory? I guess I have found a partial solution by going to "VI properties->execution->clear indicators when called", which will clear the data left in the indicators from previous data.

 

Thanks.

0 Kudos
Message 3 of 6
(18,160 Views)
Solution
Accepted by topic author Spiral

One method would be to reduce the number of times you copy the file data through shift registers. You can also use "new data value reference" function instead of shift registers if you need to use your data file multiple times. Once you are done processing data, use the  "delete data value reference" and "request deallocation" functions to clear the memory.

 

You can also use the below link for more information.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/memory_management_for_large_data_sets/

National Instruments
Applications Engineer
Message 4 of 6
(18,119 Views)

Thanks, I really appreciate. This basically solves my problem. I used new data reference and in place element structure in this program. After loading about 100 M data file, the memory is about 700M. And it does not increase after I load different data sets. My only question is how to release the 700 M memory after I stop the program? The "request deallocation" does realease about 100M memory but not all 700 M. 

0 Kudos
Message 5 of 6
(18,068 Views)

You can also try clearing the graphs and indicators as well. In front panel, go to file>>VI Properties>>clear indicators when called. You can also try initializing the shift registers because if not they carry on the data from previous runs. Hope this helps.

National Instruments
Applications Engineer
0 Kudos
Message 6 of 6
(18,023 Views)