LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leakage?

I believe I may have a memory leakage problem, but don't know how to track it down. All the memory indicators in windows task manager are increasing, along with the number of handles. Basically my program is just simulating some data, writing it to file, then reading the file and plotting it. I am using the write characters to file.vi, and don't use any open or close references. In each cycle the files are read to an array, so the next cycle the values in each array are replaced. Each days data is held in arrays running through a shift register. At the end of the day these arrays are cleared using delete from array function. Does anyone know how I might track down the source of the increasing memory usage? I would attach the vi's, but at the moment th
ey are pretty hard to follow, as I haven't cleaned it up to use clusters for passing to subvi's yet.
Thanks for any advice,Paul...
0 Kudos
Message 1 of 13
(4,581 Views)
I had the same problem on a win98 machine with a vi using the write to
file.vi.
I wrote a small test vi without any arrays and shift regiter only with a
huge string coninously appending to a file. When I run this vi the memory
also is decreasing. I thing it is a problem of win98. It is known that win98
has probelms handling memory. But I made the experiance, that windows free
the memory again when the available memory reaches zero and my application
doesn't get slow. I don't know what happens if you ned very high
performence.

I asked the NI support about this problem, but I didn't get an answer.

The problem does not occure on a win2k machine. Which os are you using?

Hope that helps, Niko
Message 2 of 13
(4,581 Views)
Thanks for that Niko, that information will come in handy. I may have posted my problem prematurely, as I neglected to have a full set of historical data filed, so am retesting... will take a few hours. The target machine is win98 so any more info about this OS will be appreciated. For example: The computer is in a (very) remote location with frequent powerouts. We will probably get a UPS to handle long powerouts, but I need to know the effects of powerouts and crashes on the system rebooting. Say if the power is cut off and then turned back on, does the computer restart? What about when a crash occurs? Will it restart itself then?
Thanks for your help

Paul
0 Kudos
Message 3 of 13
(4,581 Views)
I installed a lot of systems for data apuisation at remote locations and I
use the ac power back function of the bios to restart the systems after
power failures and that works fine up to now. Of cource the application is
start via the autostart and the os has to be configured that no user login
is nessacary.

Niko
0 Kudos
Message 4 of 13
(4,581 Views)
excellent - didn't realise there was a setting in BIOS. Thanks Niko
0 Kudos
Message 5 of 13
(4,581 Views)
First, a little semantics, if the amount of memory usage in you computer is increasing for justifiable reasons (i.e. you are acquiring more data) this is not a memory leak, it's just how much memory your application needs to run. A memory leak is when you application is consuming more and more memory when it shouldn't be.

For example, say you have an application that's acquiring data and adding it to an array in a shift-register. Let's further assume that you have incorporated logic such that the program only saves the last 5000 samples. As the program starts running the buffer in the shift-register will start filling, and memory usage will go up. At some point though, the buffer will fill and reach it's maximum size of 5000 sample. At that point the mem
ory utilization of the application should stabilize at some level.

If it keeps going up, THAT'S a memory leak.

The most common causes of memory leaks are leaving references open, and repeatedly reopening a reference to the same resource without closing the old reference. Occasionally, a driver or other external code will also leak memory.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 6 of 13
(4,581 Views)
Thanks Mike, your comments are well noted - this is the reason for retesting with full history and giving arrays time to fill. It turns out it is actually a handle leak, and I don't know how I'm going to resolve it. So far I have tested for the write PNG and it isn't leaking. If I am fortunate enough to pinpoint the cause of the leak, do you have any suggestions how to resolve it? I am not opening any references - am just using local property and invoke nodes. I have set deallocate memory ASAP. The kernel memory rises continuously. I am starting to think I will have to programmatically reboot once a week to resolve this. How many handles can a handle handler handle?

Thanks, Paul
0 Kudos
Message 7 of 13
(4,581 Views)
The first thing to do is try to factor large subsets of your code. For example, isolate you data acquisition code by replacing it with random number generators.

Simplify your code a little bit at a time by stripping out peripheral functions--like file saving--until you see that the leak goes away. Then you have a definite place to start looking.

Alternately, you can try to reduce the code down to the simplist form that demonstrates the problem. Once you get this simple form, it will be easier to unravel the problem--assuming of course that you don't discover a logic error during the simplification process.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 13
(4,581 Views)
Hi Mike, after deleting 90% of my code... I think I found the problem - it seems I AM using a reference after all. Only thing is, I don't know how to close it! can you take a look at the GIF and give me a tip please?

Thanks for your help, Paul
0 Kudos
Message 9 of 13
(4,581 Views)
its ok I got it - "close" duh! thanks heaps for your valuable input. Problem solved

Paul
0 Kudos
Message 10 of 13
(4,581 Views)