01-08-2019 12:51 PM - edited 01-08-2019 01:01 PM
@Ben wrote:
No, only when the resulting array is larger than what was previously allocated. Back when I was first exploring this detail I built an VI that repeatedly add a value to an array in a shift register and then tracked how long each iteration needed to complete.
At that time (LV 6i maybe) LV would start by allocating maybe 1000 elements for the array. every time if grew beyond the previous allocation, LV would double the size of the array (based on what I saw being used the Task Manager Performance).
So not every time, but only when required.
LV will also not release memory after a buffer is allocated since it is very expensive time-wise to allocate and deallocate memory.
Ben
This means that for every instance of build array function in my block diagram labview has allocated a certain amount of memory and every time i call that function it makes changes in that part of memory only ???
-Rishav
01-08-2019 01:20 PM
@rishavpreet wrote:
@Ben wrote:
No, only when the resulting array is larger than what was previously allocated. Back when I was first exploring this detail I built an VI that repeatedly add a value to an array in a shift register and then tracked how long each iteration needed to complete.
At that time (LV 6i maybe) LV would start by allocating maybe 1000 elements for the array. every time if grew beyond the previous allocation, LV would double the size of the array (based on what I saw being used the Task Manager Performance).
So not every time, but only when required.
LV will also not release memory after a buffer is allocated since it is very expensive time-wise to allocate and deallocate memory.
Ben
This means that for every instance of build array function in my block diagram labview has allocated a certain amount of memory and every time i call that function it makes changes in that part of memory only ???
-Rishav
Yes the previously allocated memory buffer is used provided there is enough space allocated. It is only when the allocation is not large enough that a larger buffer is allocated and the old data moved to the new allocation and the old buffer it returned to a cache that LV maintains to potentially be used elsewhere in the application.
You can investigate this more yourself by creating a test VI that uses code you you want to test out and then use;
Tools >>> Profile >>> Profile Buffer allocations
Ben
01-08-2019 01:22 PM
@rishavpreet wrote:
This mean by using Replace array subset i will have to wire values one by one (basically using as many replace array subset functions as there are variables) where as in build array function i can wire values all at once and get my required array.
You can use an array as subset. It does not matter how you replace elements, but if the big arrays resizes or not. Also, replace array subset is growable.
Again, don't use words, show us functional code.
01-08-2019 01:36 PM
@Ben wrote:
@rishavpreet wrote:
@Ben wrote:
No, only when the resulting array is larger than what was previously allocated. Back when I was first exploring this detail I built an VI that repeatedly add a value to an array in a shift register and then tracked how long each iteration needed to complete.
At that time (LV 6i maybe) LV would start by allocating maybe 1000 elements for the array. every time if grew beyond the previous allocation, LV would double the size of the array (based on what I saw being used the Task Manager Performance).
So not every time, but only when required.
LV will also not release memory after a buffer is allocated since it is very expensive time-wise to allocate and deallocate memory.
Ben
This means that for every instance of build array function in my block diagram labview has allocated a certain amount of memory and every time i call that function it makes changes in that part of memory only ???
-Rishav
Yes the previously allocated memory buffer is used provided there is enough space allocated. It is only when the allocation is not large enough that a larger buffer is allocated and the old data moved to the new allocation and the old buffer it returned to a cache that LV maintains to potentially be used elsewhere in the application.
You can investigate this more yourself by creating a test VI that uses code you you want to test out and then use;
Tools >>> Profile >>> Profile Buffer allocations
Ben
Thank you.
-Rishav