LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory allocation in Labview

Memory question:

If I have an array of numerical constants inside of a while loop that
runs continuously, does memory for that array get allocated each
iteration? Should I move it outside of the while loop?

thanks,
stephen
0 Kudos
Message 1 of 4
(2,821 Views)
Stephen Gray wrote:

> Memory question:
>
> If I have an array of numerical constants inside of a while loop that
> runs continuously, does memory for that array get allocated each
> iteration? Should I move it outside of the while loop?
>
> thanks,
> stephen

Maybe and yes , move it outside.

Seems like last time I checked this it was smaller and ran faster
if the constants are OUTSIDE the loops.

you can use the profiler to check this out.

Kevin Kent
0 Kudos
Message 2 of 4
(2,821 Views)
Hello Stephen,

Memory allocation is probably revised at each steps, as I
understand. Memory is allocated at first step of loop, but
also newly allocated at each steps....

You could get accurate information by comparison test run
of Replace Array Elements and Build Array. The former is
less run-time consuming than the latter because of without
memory re-allocation.

Thanks in advance,
Tom (Tomoya ITO)

Stephen Gray wrote:

> Memory question:
>
> If I have an array of numerical constants inside of a while loop that
> runs continuously, does memory for that array get allocated each
> iteration? Should I move it outside of the while loop?
>
> thanks,
> stephen
0 Kudos
Message 3 of 4
(2,821 Views)
It depends on whether the array is resized in the while loop. If not, LV
will not allocate new memory with each iteration.

Stephen Gray wrote in message
news:3A671C0F.3854BF4B@swri.org...
> Memory question:
>
> If I have an array of numerical constants inside of a while loop that
> runs continuously, does memory for that array get allocated each
> iteration? Should I move it outside of the while loop?
>
> thanks,
> stephen
0 Kudos
Message 4 of 4
(2,821 Views)