LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging memory usage (LabView 6.1)

I have a problem that memory usage by labview program increases steadily. The program is written in such way that it has to constantly create and delete 2D data arrays and data clusters. Is this possible to debug which varaible (array, cluster), subVI, etc occupies the most memory? Note: I tried to use "Deallocate memory handlers as soon as possible" option in LabView, but it didn't help.
Thanks a lot for help, Misha.
0 Kudos
Message 1 of 4
(2,989 Views)
Two hints that might help improve your problems. One. when building arrays are you using the build array function or are you using for loops and utilizing the auto indexing feature in LabVIEW. It is more effiecient to utilize the auto indexing terminal. Two. Can you use the same array each time your create a new elements. Instead of deleting and creating a new array maybe try replacing the elements in the existing array. When using the replace array element you are utilizing what is called implaceness. Basically your are utilizing the same buffer space that you already allocated for that array. Another solution is to try and preallocate your arrays. There is a way to look at where a new memory space is being created in your vi by utilizing the showimplac
eness undocumented ini setting. Check out this link. http://labview.brianrenken.com/INI/. Hope this helps. One other concept that I am not sure you are working with is references. Make sure you close any reference that you will not be using again. They also can cause problems like you are seeing. Hope this helps. If not try posting your vi and let us look at it.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 2 of 4
(2,989 Views)
Thank you very much for the answer. It seems that the problem was that I used BuildArray icon with array and new_value as inputs and the output was the same array. I thought it was absolutely equivalent to InsertInToArray icon. Just to make sure: Do I understand corretly that in the latter case LabView uses the same memory space that was already allocated for old array, but in the first case it allocates new memory space? In general, where can I found out what different array operations do with memory.
Thanks again, Misha.
0 Kudos
Message 3 of 4
(2,989 Views)
Yes you are correct. Everytime you use a build array function you are creating a new buffer space for that array. For the simple fact that LV doesn't know how much bigger you want the array to be so it needs to depend on you to tell it. When you use the replace array element LV knows the size of the array already and knows that you are not adding any size to the array. Excellent question... I posted your question. Keep an eye on this: http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000C1C70000&USEARCHCONTEXT_CATEGORY_0=_49_%24_6_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 4 of 4
(2,989 Views)