LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

memory allocation using auto indexing

How does labview handle the case shown below?

 

Will it generate a new array each time through the loop?

 

What happens to the old array?  Do I need to de-allocate it somehow?

 

(I searched the forums, but couldn't find an answer - I must be asking the wrong question ..)

 

 

 Memory Allocation with auto indexing.jpg

 

0 Kudos
Message 1 of 6
(3,706 Views)

Rfolea,

 

Hello! I built the VI seen below to test this question and verify my suspicions. The code builds a large array, but hits the breakpoint right before it exits the for loop (I did this to watch the processor and memory performance in the Windows Task Manager). What happens is that LabVIEW allocates the space for that array on the first time It is built. Every time the while loop runs after that, the data in the array is lost, but the memory allocated for the array stays the same and the values in it are rewritten. When your VI stops running, LabVIEW then de-allocates the memory for that array.

 

Array_Test.PNG

 

Let me know if this answered your question or not.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 Kudos
Message 2 of 6
(3,675 Views)

Hi Ben,

 

Thanks for looking onto this.

 

So .. it sounds like this is a perfectly valid way to handle this.  That's good news.

 

 Thanks!

 

 

 

0 Kudos
Message 3 of 6
(3,671 Views)

I disagree. This is BAD news if NI itself ruins their nice forum by answering any question on any topic in any community.

 

Isnt' it possible to move a question on LabVIEW to the corrsponding forum and answer it there?

 

Out of the top 12 most recent postings I found this morning in the CVI forum 4 were off topic!

 

 

0 Kudos
Message 4 of 6
(3,649 Views)

Wolfgang,

 

Thanks for pointing that out, I didn't notice that this wasn't in the LabVIEW section. I actually can't move this thread (else I would), but had I noticed I would have requested the original poster to go re-create it in the correct category and answered the question there instead.

 

Thanks again for making us aware of this and I apologize for not catching it myself.

 

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 Kudos
Message 5 of 6
(3,629 Views)

Apologies - I didn't realize I was in the wrong area when I posted this - wil be more careful in the future ...

 

Thanks again for the help!

 

 

0 Kudos
Message 6 of 6
(3,623 Views)