LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why 500KB VI uses 120MB of RAM ?

Please take a look at attached VI ( exe and source files)
exe takes 120MB of RAM when running. VI diagram takes 100% and long time to save. Where is the problem ?
0 Kudos
Message 1 of 7
(3,766 Views)
Hello
I just took a quick look at you vi. Saturday is not the best day to labview.....

Well, basically, there are 8 strip charts. each one has a history lenght of 172800 elementes. that means a total history lengh of 1382400 elements
Every element is a waveform ( 16 bytes timestamp, 8 bytes dt and 8 bytes SGL 1 element array). So, every element is made up of 32 bytes. History lengh is about 44 MBytes. Now, some copy buffer , etc...... Yes. It can be more than 100 Mbytes of memory.

I am not too positive about my calculus, but I suggest you to decrease History lengh of strip charts and take a look at application notes about data storage and memory management.

Hope it helps
Cheers
Alipio.
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
Message 2 of 7
(3,743 Views)
Changed history length to 1024 points, RAM usage droped to 25MB. But user needs long history on chart, at least 100000 points.
0 Kudos
Message 3 of 7
(3,734 Views)
I just run profiler and I see that "General Error Handler Core.vi" uses 18,08k bytes. Thats almost half total usage.
0 Kudos
Message 4 of 7
(3,731 Views)
Hi

Ok. If your points are sam'led at constant time , you can use a standard chart. Just use property nodes and put x0 as start timestamp and x increment as time among points. Actually, you don´t need waveforms for you app. A SGL history lengh can manage all your points.Bear in mind that history lengh is an initializad arry of input element, so you can calculate roughly how much memory will need.

If points are not equally time spaced, and you want to have a real reference of that difference, look in this site for simulated XY chart. you can simulate a chart using XY graph and a buffer.

Hope it helps

Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 5 of 7
(3,715 Views)
Does history allocates memory for all samples when VI is started ? I thought that more memory is used as new samples is acquired.
0 Kudos
Message 6 of 7
(3,714 Views)
Hi

Yes. you are right. In a waveform chart,Labview tries to allocate enough contiguous memory space dinamically at run time. You will get an error when no more contiguous memory is available.

Memory is allocated at vi init if you use an initialized array whit constants.

In your program, perhaps you can display all data in a chart and use the ../examples/general/charts.llb/real time chart vi. Take a look. It will allow user to check data using cursors.


Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 7 of 7
(3,695 Views)