LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid the double memory assignment for an array which I connected to the shift register?

Hi,
I need to read a big block of data into an array. When I stop the program and then restart, I hope  the program to use the previously load arrary instead of reloading it. So I put the initiat Data loading in a for loop (N =1) and connect the array to a shift Register. The problem here is it assigns memory twice,  for the initiator data loading and shift register. Is there any way to limit the memory assaignment to 1 since I only need one copy.

Thanks.
Message 1 of 15
(2,893 Views)
Could you post a screenshot of the code or a VI showing the problem you want  solved?

André
Regards,
André (CLA, CLED)
Message 2 of 15
(2,888 Views)
Since my original file is more than 2M and really comlicated, I just make a simple demo file to show my purpose.

Simply,
If I put the data reading before the initiator of shift register, only 1 copy of memory will be assigned. But when I stop the running, and then restart the program, it need to re_load the data.
if I put the data reading inside the for loop (n=1) and connect the array to the shift register inside the loop, I don't need re-load the data when I restart the program, but two memory is needed.
Message 3 of 15
(2,882 Views)

We would probably need more information. Can you post your code or show us a diagram image with "show buffer allocation" enabled?

What is your LabVIEW version?

0 Kudos
Message 4 of 15
(2,877 Views)
LV 7.1
I need to say, the original loaded data array is about 174 M bytes. My raw file is 2G, I try to load 1/10 per time.

I will send my code to you if you need.

Message Edited by JWJ on 09-03-2007 02:11 PM

Message Edited by JWJ on 09-03-2007 02:12 PM

0 Kudos
Message 5 of 15
(2,873 Views)


@JWJ wrote:
Since my original file is more than 2M and really comlicated, I just make a simple demo file to show my purpose.

Your current code is way too confusing, so I assume that the full code makes more sense. The program is unusable because the main FOR loop gets locked in an inner loop that consumes all CPU doing nothing.

I think that branching the main array into the (1) case structure and (2) inner while loop costs you an extra allocation. Here's a more reasonable way to do things. It elimiates the buffer allocation going into the case structure.

Message 6 of 15
(2,867 Views)

do you refer to the fact that the first time you run your AE, then at initiation - read of array AND at shift register the memory is allocated? in this case, the first time you run it the shift register is empty, therefore memory allocation there is minimal.

if you refer to the second (and next..) time of running the case structure, you then have twice memory allocations, i have read that LV became (even more) efficient in that, and doesnt actually allocate memory to the false (not used ) case.  maybe Altenbach can confirm that?

 

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 7 of 15
(2,865 Views)
I modify the the demo vi.

Message Edited by JWJ on 09-03-2007 02:18 PM

0 Kudos
Message 8 of 15
(2,864 Views)
here is the original code. Please compare the JPG file to see the twice allocation of the two arrays. For the Simple precision array, I need to change the data during the process, while the I16 array will not be changed.
0 Kudos
Message 9 of 15
(2,858 Views)

Oh wow! Do we need a pilots license to operate that VI? 😄

Sorry, my monitor is not big enough to successfully find my way around on that diagram. Can you pinpoint the approximate location of the problem code?

Message 10 of 15
(2,853 Views)