From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of Request Deallocation

Solved!
Go to solution

Hello Everyone ,

 

I would like to use request deallocation function in my software . 

My code is a QMH in which one of the states is an imaging state . I have multiple big arrays passed by data references in this loop . There are some subVI's that are used for array manipulation and I suspect they might be creating copies that isn't released until the application is stopped. There are also some IMAQ vi's placed in subVI's that are running preallocated reentrant .

 

I am facing out of memory errors sometimes and for this I am thinking of placing the request deallocation function after the loop calling the subVI's is stopped . I cannot stop the top level VI and it should keep on running . I cannot post the code since it is confidential but I can provide a simple mock code that can be found attached .

 

Also , what is the ideal way to get rid of the array from the ram ? I read the data reference of the array using IPE and wire the array to a reshape array  with 0 as rows and columns then delete the reference, is this ideal . Anybody's got a better suggestion ?

 

And lastly , if I were to delete a Data reference of an Array and extract the data from the delete reference function , what is happening here ? is it just deleting the reference or the array in memory space ? If I don't extract  it will it just rest in memory and not be released until  the calling  VI is closed ?

 

An important point to consider would be that I am using NI RT Linux target .

 

Looking forward to your response and critiques ,

 

Best Regards,

SP_TT

0 Kudos
Message 1 of 5
(1,249 Views)

@SP_TT wrote:

Also , what is the ideal way to get rid of the array from the ram ? I read the data reference of the array using IPE and wire the array to a reshape array  with 0 as rows and columns then delete the reference, is this ideal . Anybody's got a better suggestion ?


What you are doing should release the memory; the deallocation should not be necessary. I do the same thing, on Windows though, and see the memory released. No deallocation necessary.

 

Your issues are probably in your math and subVIs. Since you cannot show them, I suggest you play "whack the dots." Turn on the profile tool to see buffer allocations, if you have dots on both sides of the IPE structure, then you have copies. Try to eliminate as much as possible.

 

mcduff

0 Kudos
Message 2 of 5
(1,203 Views)

Hello Mcduff ,

 

Thank you for your inputs . I shall try to check for allocated buffers .

 

In theory shouldn't request deallocation function help clear these buffers after loop execution is completed ? it might be that these allocated buffers aren't getting reused by LabVIEW and it might be piling up the memory ?

0 Kudos
Message 3 of 5
(1,160 Views)
Solution
Accepted by topic author SP_TT

@SP_TT wrote:

Hello Mcduff ,

 

Thank you for your inputs . I shall try to check for allocated buffers .

 

In theory shouldn't request deallocation function help clear these buffers after loop execution is completed ? it might be that these allocated buffers aren't getting reused by LabVIEW and it might be piling up the memory ?


You can try, but in my experience request deallocation either doesn't work they way I want it to work or the program has some weird hiccups because of deallocation.

 

The following thread is old, but it shows you what to look for when you try to whack the dots.

 

https://forums.ni.com/t5/LabVIEW/LabVIEW-2015-Buffer-Allocation-Bug/td-p/3300392

 

mcduff

0 Kudos
Message 4 of 5
(1,150 Views)

Great , Thank you for your helpful suggestions . Have a nice day !

0 Kudos
Message 5 of 5
(1,138 Views)