08-23-2011 04:32 AM
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?
Solved! Go to Solution.
08-23-2011 06:50 AM
The front panels of sub vi's are often optimized away. If you set Subroutine priority it always is.
/Y
08-23-2011 07:21 AM - edited 08-23-2011 07:22 AM
Hello Raj,
I have done the following Steps:
1. I created a Vi with the following code:
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:
2. I closed LabVIEW, restarted it and checked its Memory- Usage:
3. I opened my VI and checked LabVIEW's Memory usage again:
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.
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:
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:
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,
08-23-2011 11:27 PM - edited 08-23-2011 11:27 PM
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....
08-24-2011 02:55 AM
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
08-24-2011 08:38 AM - edited 08-24-2011 08:41 AM
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:
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.
08-24-2011 08:46 AM
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.