LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array allocating more memory

 

Dear all,

I am creating an array of 20*200000 of I16 data type.

Memory it should allocate = 20*200000(array size) * 2(bytes) = 8000000 bytes =  7.7 MB

 

but, when i run the Performance and Memory tool to track how much memory the VI is allocationg, it shows rougly 32 M.

 

Y is that happening?

 

 

Ritesh

0 Kudos
Message 1 of 24
(3,225 Views)

I would suggest tossing the indicator or checking usage with FP closed.

 

1) The data in the wire.

2) The data in the indicaotr

3) ??? un-do buffer

4) ??? default data for indicator.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 24
(3,216 Views)

Your indicator is the hog. Without it, we're close to your estimate of 7.7MB. See attached, with indicator in a sub-vi.

 

You may also note that two arrays of 10 * 100000 eat up less memory than one at 20 * 200000. I think your're reaching the limit of what the bucket effectively holds. Smiley Happy

Richard






0 Kudos
Message 3 of 24
(3,193 Views)
I tried with FP closed, and the Memory Profile is showing 16 MB. still more than double the size it should allocate .
0 Kudos
Message 4 of 24
(3,190 Views)

Broken Arrow wrote:

 

You may also note that two arrays of 10 * 100000 eat up less memory than one at 20 * 200000. I think your're reaching the limit of what the bucket effectively holds. Smiley Happy


Of course it would.  You've cut each dimension in half (thus 1/4th memory) then multiply by 2 arrays.  So two arrays of 10x100,000 should be about half the memory of one array 20 x 200,000.

0 Kudos
Message 5 of 24
(3,184 Views)

So you're saying 10 * 1 is 1/4 of... oh wait. Smiley Tongue

 

OK, but the first part is still true! Smiley Very Happy

Richard






0 Kudos
Message 6 of 24
(3,172 Views)
Also don't forget that if you use all constants like in the code you show, the initial array data is folded into a constant at compile time, creating another data copy in RAM. Replace any of your diagram constants with a control containing the same value and you'll see what I mean. 😄
Message Edited by altenbach on 05-19-2009 01:46 PM
Message 7 of 24
(3,168 Views)

altenbach wrote:
Also don't forget that if you use all constants like in the code you show, the initial array data is folded into a constant at compile time, creating another data copy in RAM. Replace any of your diagram constants with a control containing the same value

Yeah. Thanks alot for such a cool tip. Its showing exactly 8 MB after allocating the memory.

 

But one problem that still remains is that any processing done on data will make another copy of the data. Now that will eat up the RAM really fast and will cause memory flow. I am dealing with large sets of data(50 MB). and doing some kind of processing on it before desplaying it on the graph. 

now the 50 MB of data will eat up the memory in no time even if little processing is done on it .

 

How can i handle lagre amount of data and making sure no new copies are made and any processing done on the data will replace values with the previous data ??

0 Kudos
Message 8 of 24
(3,156 Views)

ritesh024 wrote:

How can i handle lagre amount of data and making sure no new copies are made and any processing done on the data will replace values with the previous data ??


If you code things right, you can minimize the number of data copies. and even do things completely "in place". Don't forget the "show buffer allocation" tool. Now code away and see if you can avoid extra data copies.

 

This might require a lot of experience. Feel free to post you code so we can help. 😉

Message 9 of 24
(3,138 Views)

ritesh024,

 

Do not try to graph  50 MB of data!.  The graph can only display as many datapoints as it has pixels on the horizontal axis (for  a line graph).  If your graph is about 1000 pixels wide, only send it 1000 pixels.  If you send more than that, LabVIEW will do some processing to reduce the data to the number of pixels.

 

Lynn 

0 Kudos
Message 10 of 24
(3,090 Views)