LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak?

Wow! I appreciate all the help! Let me establish a few things first,
and then I'll continue. I am somewhat of a seasoned LabVIEW programmer
(been using it for 6 years). Therefore, I'm pretty proficient, and I
know most of the pitfalls that you can run into.

Besides that, to answer some questions, I am just displaying the data to
a graph. Therefore, there is no history data, and the graph is cleared
after every loop and only shows the new 120 milliseconds of data.

Next, I started with the AI config and AI clear out of the loop,
configuring the buffer once and reusing it every loop, and then clearing
it when the loop terminates, but I had the same memory problem. I
tried putting the AI config and AI clear in the loop to see if that
would help, but it didn't.

I am opening a TCP/IP connection if a request is made, but I took that
part of the code out and I'm still having the problem.

I am opening VI references to other front panels that configure
parameters and such, but these VI references are not called on every
loop. They are called when a button is pressed, and the VI which is
opened is set to close (close if originally closed) when the VI
completes. A Close VI Reference is NOT called, however. I have not
checked to see if the VI does not hog memory if I don't press a button
which opens a VI reference.

I will check to see if VI info gives me a clue to which VI is using all
the memory. I'll keep you posted. I'd really like to solve this memory
situation, and maybe help somebody else out in the meantime.

Mark

In article ,
E. Fudd wrote:
> Mark,
> Your problem is with the repeated calls to the AI vi's. Repeatedly
> creating and clearing the Ai buffer tends to consume memory for some
> reason. If you're acquiring the same number of scans for each of your
AI
> operations, you can re-use the buffer by moving the AI config and AI
> clear vi's out of your loop.
>
> Hope this helps..
> -Todd
>
> In article <8nh5m0$7hc$1@nnrp1.deja.com>, markwysong@my-deja.com
says...
> > I have a VI which consists of a loop that basically sets up a
buffer,
> > sets up an analog trigger, then scans in 120 ms of data when the
trigger
> > occurs. I read the data out of memory and display it on a graph,
use
> > AI Clear to clear the acquisition, then perform the loop all over
again.
> > After a few days, Windows NT starts showing memory errors, and when
I
> > check what is hogging the memory, it's LabVIEW. If I shut down
LabVIEW
> > and start over, it starts up at about 17 MB of memory, then steadily
> > increases over a couple of days to 110 MB until I get warnings about
low
> > virtual memory, etc.
> >
> > Any ideas what could be causing the problem? (The
> > "Edit->Preferences->Performance and Disk->Deallocate memory as soon
as
> > possible" is checked, and I am running with multiple threads)
> >
> > Thanks,
> >
> > Mark
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 6 of 14
(1,682 Views)
....
> I will check to see if VI info gives me a clue to which VI is using all
> the memory. I'll keep you posted. I'd really like to solve this memory
> situation, and maybe help somebody else out in the meantime.
>

These sound like good places to look, but you may be able to speed up your
search by using the VI profiler and some other debug techniques. Start the
profiler, enable memory tracking, run the VI and make it complete, then
update the profile info by stopping it or snapshotting it. This may already
give you some clue as to the data hog. Next you can profile the VI
again for a
longer amount of time. This will show what is growing, and what is constant.

If this doesn't show you the culprit, then you can start changing the VI to
isola
te the leak. Delete out the graph, the VI Server, and other things that
accept the data and may accumulate, from those things that produce it. Also,
when you have a guess as to the leak, you may want to build a small test to
prove or disprove where the leak is.

Good luck.
Greg McKaskle
0 Kudos
Message 11 of 14
(1,398 Views)
I have had troubles before with opening and closing TCP/IP connections/ ref
nums many times in loops, gobbling up memory and crashing Labview. I
resolved the problem by opening the TCP/IP connection once and keeping the
refnum in a storage VI and using it as needed throughout the program and
closing off the refnum when the task is finished. Something else to try
anyway .

wrote in message
news:8nh5m0$7hc$1@nnrp1.deja.com...
> I have a VI which consists of a loop that basically sets up a buffer,
> sets up an analog trigger, then scans in 120 ms of data when the trigger
> occurs. I read the data out of memory and display it on a graph, use
> AI Clear to clear the acquisition, then perform the loop all over again.
> After a few days, Windows NT start
s showing memory errors, and when I
> check what is hogging the memory, it's LabVIEW. If I shut down LabVIEW
> and start over, it starts up at about 17 MB of memory, then steadily
> increases over a couple of days to 110 MB until I get warnings about low
> virtual memory, etc.
>
> Any ideas what could be causing the problem? (The
> "Edit->Preferences->Performance and Disk->Deallocate memory as soon as
> possible" is checked, and I am running with multiple threads)
>
> Thanks,
>
> Mark
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
0 Kudos
Message 13 of 14
(1,389 Views)
Just as an FYI, I found the culprit for the memory leak. It occurs when
I write a .png file to the hard disk. This happens with the
Graphics & Sound -> Graphics Formats -> Write PNG File VI. This VI
calls the lvpng.dll, which must be causing the problem. When I save a
file every loop (about every .5 seconds), the VI takes up more and more
memory, and gobbles up all 128 MBytes in about 2 days.

By creating a new VI with just the capture front panel png and writing
the file to disk, and looping that much faster, I can use up all the
memory in about an hour. I also duplicated this in Windows 95 as well
as Windows NT.

I have emailed NI about this problem. See "NI's response to .dll
problems" in this forum for their response.

Mark

In article <39ab9ac3@newsgroups.ni.com>,
"Leo" wrote:
> I have had troubles before with opening and closing TCP/IP
connections/ ref
> nums many times in loops, gobbling up memory and crashing Labview. I
> resolved the problem by opening the TCP/IP connection once and keeping
the
> refnum in a storage VI and using it as needed throughout the program
and
> closing off the refnum when the task is finished. Something else to
try
> anyway .
>
> wrote in message
> news:8nh5m0$7hc$1@nnrp1.deja.com...
> > I have a VI which consists of a loop that basically sets up a
buffer,
> > sets up an analog trigger, then scans in 120 ms of data when the
trigger
> > occurs. I read the data out of memory and display it on a graph,
use
> > AI Clear to clear the acquisition, then perform the loop all over
again.
> > After a few days, Windows NT starts showing memory errors, and when
I
> > check what is hogging the memory, it's LabVIEW. If I shut down
LabVIEW
> > and start over, it starts up at about 17 MB of memory, then steadily
> > increases over a couple of days to 110 MB until I get warnings about
low
> > virtual memory, etc.
> >
> > Any ideas what could be causing the problem? (The
> > "Edit->Preferences->Performance and Disk->Deallocate memory as soon
as
> > possible" is checked, and I am running with multiple threads)
> >
> > Thanks,
> >
> > Mark
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.
Message 14 of 14
(1,389 Views)