LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What causes memory use of my program increase? (Write to Spreadsheet? Running in LV environment? External dlls? Waveform graphs?)

Hi 

 

  I have attached a plot for the discussion here..

 

  I am monitoring the memory usage by my VI thru calling a window's dll to keep checking that (Many thanks to Matt). 

 

  I saw raising slopes and flat (wow! First time I catch this, that's what I am expecting)

 

  I am thinking where could there be a reason for memory growing up!

 

What I did:-

1. Mostly use queues (all limited # of elements) for parameters delivery between loops and between subVIs

2. I close Obtained queue ref. every time I finish with it (only leaving a few keeping alive so they won't be killed)

3. For all arrays I initialized with a fixed size array constant and do all jobs with Replace subset, Index Array and that In-place block.

 

Above are measures I intended to use to save memory.

 

  However for a few points I think there might cause a memory grows, and I wish that someone can share with me your experience or give me an answer...

 

1. Write to spread file:-- I keep using this to log data, events into harddisk, in my use I always append new logs/data to the existing file, however I keep doing it all the time throughout the run-time.

 

2. Running my program in LV.exe -- I havn't compiled it yet. However when I was taking the plot's data, my PC is left with no one using it.

 

3. There is a couple of external dlls running -- however it sounds to me from other's view point, external dll's resource doesn't count into Labview.exe. Since I am monitoring Labview's memory use, that couldn't be a source of the raising I see from this plot, right?

 

4. Waveform graphs -- I am not sure whether this can be a problem. Everytime I feed data into a waveform control, I initialized a constant array and then replace elements into it, I don't think my data source is casuing any problem.

 

  Can someone comment on my above descriptions of my program?

 

Raymond

0 Kudos
Message 1 of 5
(2,412 Views)

It sounds like you are doing many of the right kinds of things to avoid memory leaks.

 

How much memory is used? How fast is it increasing?

 

Can you post your code?

 

Lynn

0 Kudos
Message 2 of 5
(2,408 Views)

Hi,

 

  I forgot to attach the plot. Please check the attachment.

 

  That'd be great if I can post my code here, however it's around 10MB and I got some network usage limitation here. Let me do that after I can access other network. I start to think that I may see how memory usage would change if I disable the write to spreadsheet.

 

Raymond

 

0 Kudos
Message 3 of 5
(2,406 Views)

@vgbraymond wrote:

1. Write to spread file:-- I keep using this to log data, events into harddisk, in my use I always append new logs/data to the existing file, however I keep doing it all the time throughout the run-time.


Write to spreadsheet file is a high level VI that opens and closes the file with every call. I would recommend to open the file once at the start of the programs, then append using lowlevel functions. Close the file after the program is done.

 

Have you done any profiling to see which subVIs shows the bulk of the memory use?

 

You might also turn off debugging to see if it makes a difference. Don't open the front panel of subVIs (and avoid functions that force the front panel to be in memory) unless they need to show something important to the user.

 

It would really help if we could see some actual code. Can you strip it down to the essentials that still show the problem?

0 Kudos
Message 4 of 5
(2,401 Views)

It would be helpful if you post your code. You could also put some of the functions(write to Spreadsheet, call dlls) into a separate subVI and profile them individually to get more details on memory usage.

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 5 of 5
(2,373 Views)