LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unawaited memory consumption creating an array

Hello experts: My application needs a sometimes huge buffer for image acquisition and I wanted to control this to prevent any "out of memory" crash. I was surprised that LabView allocates much more memory than awaited. As my included test procedure shows creating a 1-dimensional buffer of I16 elements of size 10 MB results in a loss of 60 MB of available physical memory instead of 20 MB as awaited. Creating a buffer of I8 elements consumes the same space, I32 elements need more, but not 2 times more as awaited. Is something wrong in my considerations?

0 Kudos
Message 1 of 8
(3,121 Views)
Sorry, I forgot ot attach the test routine mentioned earlier.

0 Kudos
Message 2 of 8
(3,106 Views)
Hello Detlef,

actually you are creating an array of DBL (InitArray with DBL 50 as input parameter). Then you are converting this array to the indicator, at the moment an I16 type array. This conversion needs memory too!
Example: You create an array of 1 million elements of type DBL: this takes 1,000,000 * 8 bytes = 8,000,000 bytes. This will be converted to I16: 1,000,000 * 2 byte = 2,000,000 bytes.
In sum this vi needs ~10,000,000 bytes!

Be careful an big arrays. When there is a conversion dot on a terminal then this always results in creating new buffers (=memory allocation) for the converted data.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(3,098 Views)
Hi Detlef,

just small changes to your vi 🙂

Maybe you should have a look at "Show Buffer Allocations". In LV7.1 you find this under Tools->Advanced. This tool shows you where buffers are created in your vi.

Can you tell me where you have found the "system information.vi"?

Message Edited by GerdW on 03-29-2006 03:05 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,089 Views)

Hello GerdW

sorry, I played with the test routine and the last setting for the element type was DBL. Now I changed it back to I16. The fact remains that if I create an array of 10 Million elements of type I16 the loss of " Available physical memory" is ca. 60 MB instead of 20 MB as expected. I attached a WORD document with two screen dumps showing that.

By the way, I found the VI "System Information" in the functions palette User libraries > Windows system utility Vis . These routines are located in the library "C:\Programme\National Instruments\LabVIEW 7.1\user.lib\Winsys.llb"

Regards Detlef

Download All
0 Kudos
Message 5 of 8
(3,059 Views)
Hello Detlef,

all files in user.lib are specific to the user 🙂 So I have different files in this folder than you! Please attach this vi here in the forum...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,053 Views)
OK, here are all LLB's included in my folder user.lib.
Regards Detlef
0 Kudos
Message 7 of 8
(3,046 Views)
Hello Detlef,

in the meantime I remembered where I have seen this subVI before 🙂

Well, you should not look at what Windows says on free mem. This is influenced by other programs...
Better have a look at the VI properties->Memory Usage or use the Profiler tool with memory profiling enabled.

I tested your vi with an arraysize of 10.000.000 values of type I16 and i got a memory footprint of ~40MB. This is ok, as I also recall the following issue: when you have an indicator on an open frontpanel then LabView will create a copy of the data just for this indicator. So you get 20MB for the wire (10M of I16) and another 20MB for the indicator...
Other datatypes give similar results...

Hope this helps.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,039 Views)