LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

deallocating memory in LabVIEW 7.1

I am doing significant matrix operations (such as transpositions, multiplications, eigenvectors, etc.) involving somewhat large DBL arrays in a subVI I am writing. (An example might be using arrays of size 200 x 40000). Additionally, I have as an output an array of 100 intensity graphs of dimensions 200 x 200 (the intensity graph residing in a cluster). Upon completion of the subVI, LabVIEW then runs much slower. The entire computer system in fact is affected. I suspect that large blocks of memory are not being released.

What can be done to address this issue so that LabVIEW and the system behave normally upon exiting the subVI? I seem to remember an option (in the 'tools', 'options' dialog screens) to deallocate memory in LabVIEW as soon as not needed anymore, but I do not find this anymore (unless it is right in front of me and I do not see it which happens frequently). I would have thought to have found it in the 'performance and disk' or miscellaneous dialog screens. In any case, don't know if that would have worked to solve the problem. Suggestions are welcome.

Thanks,

Don
0 Kudos
Message 1 of 7
(3,748 Views)
One thing you could try (but I'm not sure about the effectiveness...) is to empty all the data structures you have been using, by resetting them to their default values. There is an invoke node for that.
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 7
(3,740 Views)
You can try using "Request deallocation" on the "Advanced", "Data Manipulation" pallette.

This will deallocate memory for the particular VI it is placed in.

Mark.
0 Kudos
Message 3 of 7
(3,735 Views)
Request Deallocation, as mentioned above, is the way to do it. I had a similar problem with an app running out of memory quickly, but a quick restructure to put it into sub-vi's and the use of request deallocation and all was well again.

It's worth nothing that it will only free up memory for a specific vi so you will need to put things into sub-vi's, if you don't already have them, to release the memory correctly.
Message 4 of 7
(3,708 Views)

I posted my finding on this topic awhile back. They are summarized in this link

http://forums.ni.com/ni/board/message?board.id=170&message.id=102068&requireLogin=False

(Sorry CC, but my html leason is scheduled for this week-end).

 

At that time the release of memory was only initiated when the VI in which the deallocate function was unloaded from memory.

 

I hope this helps,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,682 Views)
Yes, by setting the request deallocation vi to true it will allow the subvi to explicitly garbage collect and reclaim the RAM allocated for the subvi.  With managed memory we are often lazy and forget about the "old days" pre-LV where we had to write explicit deallocation /destructor routines to manage our memory resources.  The "request deallocation" allows some control of the memory deallocation process.  A few other ideas is to break up the array and process it in multiple subvi's, then you can allocate and deallocate memory on a smaller scale (although this can be a pain to do), also when using Matrix you have a known size of each dimension, so I think you will see an increase in performance by preallocating the correct amount of space and then can avoid buffer copying and dynamically rebuilding arrays.  Finally RAM is cheap, if you are with in a factor of 2 or so of the physical memory limitations of your system, pickup some more RAM (this is the least elegant approach and is what you would expect at of a company located in Redmond, WA).  Good luck,
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 7
(3,671 Views)
I tried the programmatic deallocation and it does appear to be working.  Thanks much, will let you know if something changes.
 
Sincerely,
 
Don
0 Kudos
Message 7 of 7
(3,652 Views)