04-26-2010 06:49 PM
For about two weeks I've been trying to track down a memory leak in a large application developed in LabVIEW 8.6.1. The compiled executable would keep growing in size at a rate of approx 2.5 MB an hour. We only discovered the problem after ~200hours of operation.
Among many other things, the application generated digital waveforms and clocked them out of an M-series DAQ as an SPI signal .
I spent hours using the 'profile performance and memory' tool to no avail. It showed NOTHING was leaking.
It only seemed to leak in the compiled executable... so I thought. It turns out the LabVIEW.exe process was leaking when running the code in the development environment, I just didn't notice.
By systematically isolating sections of code then simplifying it down, a colleague and I traced the problem down to some specific circumstances manipulating digital waveforms.
The attached zip file contains 2 seemingly innocuous vis. They serve no purpose other than to demonstrate the leak. The do not actually manipulate the digital waveform. All they do is run it in a for loop, outputting two different size waveforms.
According to the 'profile performance and memory' tool, it doesn't leak. But (in LabVIEW 8.6.1) if you check the LabVIEW.exe process memory usage, it just keeps growing.
If you compile it to an exe, the exe will keep growing.
We modified the vi in all sorts of ways, some scenarios reproduced the leak, others didn't. Without being able to tie it down exactly, we can't come up with a work around.
Our code that generates the SPI is much more complicated and seems to leak faster. The only workaround we have is to upgrade all our code to LabVIEW 2009.
We've tested this on 3 different PCs in the development environment (although they're all HP workstations) and a few other PCs (Dells etc) as a compiled executable. They all leak.
This is a problem in LabVIEW 8.6.1. I haven't tested earlier versions, but it seems to be fixed (or at least dramatically improved) in LabVIEW 2009.
So if you're using LabVIEW 8.6.1 with digital waveforms and you find your application has an inexplicable leak, now you know what may be going on.
This problem should at least be noted in the LabVIEW 8.6.x known issues.
Perhaps someone out there can confirm if the attached vi leaks on their setup too (LabVIEW 8.6.1) and can maybe narrow it down further or come up with an explanation.
Just run the 'digital waveform leak.vi' and watch the LabVIEW.exe process memory ('for loop.vi' is just a subvi. We can get it to leak without a subvi, it's just more complicated.)
04-27-2010 10:37 PM
Hello Troy,
I ran the VI on my machine with LabVIEW 8.6.1 and I noticed the same behavior. I also noticed that the 'profile performance and memory' tool didn't record this memory leak either. I have notified our R&D department of this problem through a corrective action report. This report number for this problem is 223376 so you will know which version this has been fixed in. For now though, I was able to stop this memory leak by adding indictators on the For Loop VI output. I have also tested this in LabVIEW 2009 and I couldn't reproduce the memory leak there.
I hope this information helps you with your application and if you need any more assistance please feel free to post.
JimS.
04-27-2010 10:47 PM
Thank you for confirming/verifying and raising a corrective action request.
So where do we send our invoice for 2 weeks of debugging?