LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is Memory_Usage.total much smaller than .VI_size_on_disk

Hi there,

just out of curiosity:
I have a rather complex TestSystem (>600SubVIs) with a huge 'main' VI (joblist-driven kind of state machine).
Yesterday I checked VI_properties.Memory_Usage and found this:
FP Objects:   253,2K
BD Objects:   2125,5K
Code:             480,9K
Data:              163,8K
Total:              ~3023,5K
Total VI Size On Disk: 3985,3K

During devellopment today, this got even worse.
Is there any explanation for this ~1MB extra size on disk?

Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 1 of 3
(2,617 Views)

Hi, look at this link

http://forums.ni.com/ni/board/message?board.id=170&message.id=55018&requireLogin=False

Jean-Pierre Drolet have the answer:

Avoiding large arrays being copied is an art in LabVIEW. This time the LabVIEW compiler is too smart trying to optimize the code. When you use "Initialize Array" with all constants on input, LabVIEW creates the array at compile time and saves a copy of the initialized array. When copied to the indicator, that makes two copies.

To prevent one copy, replace one of the constants (8,7 or 4320) with a FP control with the same default value. Then the array will be created at run-time only.

Do not display the array in an indicator if you can avoid it as LabVIEW makes a copy for the indicator display. The user doesn't need to see the 967,680 values. If you need an indicator to pass the array to its caller, LabVIEW will manage to reuse the arra
y space if the subVI always keeps its FP closed (no need for display).

If the large array is to be used everywhere in the application, it can be stored in the shift register of a subVI. In this subVI, put all the code required to manipulate the array (Initialize/Read/Write/ elements, etc). That will greatly reduced te number of unnecessary copies of the array.

Best Regards
Message 2 of 3
(2,584 Views)
Johann,

thx for your answer. I'll recheck that.
But AFAIK the data size of this VI is quite small, just a few kB as reported by VI properties and stated in my initial posting.

Anyway, thanx again.
Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 3 of 3
(2,572 Views)