LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory handling in VI

Solved!
Go to solution

Hi friends

 

   i have one doubt if i use one vi that vi loads in ram when its front panel opened..it loads code,data and frontapnel's data like  controls  & indicator.suppose if i use the same  vi as  subvi..is this data of frontpanel load in ram or not?

 

   

Raj
0 Kudos
Message 1 of 7
(3,016 Views)

The front panels of sub vi's are often optimized away. If you set Subroutine priority it always is.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 7
(2,997 Views)
Solution
Accepted by topic author Pandiyan

Hello Raj,

 

I have done the following Steps:

 

1. I created a Vi with the following code:

MemTst_1.png      MemTst_2.png

 

I set the dimension size to 10,000,000.

After running it, I clicked on Edit - Make current Values Default and saved it. The VI- Properties then showed:

 

MemTst_3.png

 

2. I closed LabVIEW, restarted it and checked its Memory- Usage:

 

MemTst_4.png

 

3. I opened my VI and checked LabVIEW's Memory usage again:

 

MemTst_5.png

 

The Difference is something around 310 MB, which is twice the amount of the Memory stated on the Memory Usage window of the VI. So LabVIEW seems to buffer the data at two different places.

 

4. I created another blank VI and placed my first VI on the BD, saved it and closed LabView again.

 

MemTst_6.png

 

5. After starting LabView, the Windows Task Manager shows a Memory- usage of 75.132 kB and after loading the Super- VI 387.408 kB, difference is 312 MB.

 

This shows, there is no difference between loading the VI itself and loading it as a SubVI.

 


P.S. Very interesting is the file size of the VI itself, it is only 165 kB on the Harddisk. That lets me assume, that LabVIEW compresses the data when saving the VI to disk.

 

So i altered the VI to the following code:

 

MemTst_7.png

 

I let it run, saved the current values as default and saved the VI. The Memory Usage Page of the VI- Properties showed me the following:

 

MemTst_8.png

 

The data is now almost uncompressible, so the VI- Size on diskt is almost the same than in memory.

 

As you cannot see, the dimension size is 1,000,000, which is a tenth of the first VI. LabVIEW is able, to calculate 10 million elements, is able to set the controls value to default with 10 million elements, but is not able to store that VI to disk.

 

 

This seems to be a problem with the compress algorithm of LabVIEW

 

Hope this helps,

 

 

 

 

 

 

 

 

 

 

 

Greets, Dave
Message 3 of 7
(2,991 Views)

hi Dave TW,

 

   thanks for your replay,its nice try ,,,really good,,

 

 

friends i need this thread for managing memory for helpful to all , so if anbody know it pls share this thread....

Raj
0 Kudos
Message 4 of 7
(2,962 Views)

Dave is correct from a VI-perspective. As you cannot compress noise, the random number vi will be rather large on disk.

 

From a program perspective i did the following tests:

Create a Dumbsort.vi which only makes an array sort.

Create a vi which generates some random numbers and use dumb sort to sort it.

In one run i use Dumbsort as (ordinary) subvi, in the other i change to SubVI setup to show front panel.

As you can see from the memory profiler a subvi doesnt load it's front panel and uses little memory.

 

/Y

 

 

memtestNoShowSub.png

memtestShowSub.png

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 7
(2,943 Views)

Actually, the issue is that the VI is saved with the default data on an indicator as a large array.  If you set the default value as an empty array (right click on array index, select Data Operations»Clear Array then Data Operations»Make Current Values Default), and save the VI, it will be much smaller.  Let's take a very simple example:

 

TestVISize.png

 

If you create this and save it, you get a size on disk of ~7kB.  If you set nPoints to 1M, run the VI, set current value of controls/indicators as defaults (Edit»Make Current Values Default), and save, you get a size on disk of 14.3MB.  Clear the output array, set defaults again, save again, and the VI is now back to about 7kB on disk.  This does effect load time.

 

Take home message - always save your VIs with default empty arrays. 

0 Kudos
Message 6 of 7
(2,923 Views)

Hello DFGray,

 

because in the initial question was written "...it loads code,data and frontapnel's data like  controls  & indicator." I wanted to show, that when there is data stored in the indicator, this data will be loaded too.

 

Greets, Dave
0 Kudos
Message 7 of 7
(2,920 Views)