LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows Media Player ActiveX control causes Memory Leak

Solved!
Go to solution

I am trying to write an application that will load and play *.avi files in an ActiveX control. The user should be able to load multiple files consecutively in the single player. However, there seems to be memory leak every time a file is loaded, even if it is the same file. For example, even when loading a small 81KB *.avi file repeatedly, there is a consistent ~6MB memory leak (as observed in the Task manager). The memory leak is larger when I load larger files.

 

I tried to negate this by adding using a Close Method using the Invoke Node. This recovers ~3MB of RAM, but when I load the file again, it leaks ~9MB, leaving a net leak of ~6MB yet again.

 

I also used Close Reference vi(s) to clear the ActiveX object from memory, but this did not help either. In other versions of the VI, I tried to eliminate the creation of a new IWMPlayer4 object by using a shift register, but again the memory leak persevered..

 

Attached is a simple version of the VI, as well as the small video file. In my application, I want to be able to load large video files (~600MB) repeatedly without memory leaks. Thanks in advance for your help!

 

-gpho

Download All
0 Kudos
Message 1 of 5
(4,538 Views)

Hi gpho,

 

I tried running your VI in LabVIEW 2009 and I don't see a memory leak.  I'm looking at the LabVIEW.exe process and it's memory seems to shift slightly, but it goes back down after the movie is finished.  What version of LabVIEW are you using?  Also, is it LabVIEW's memory that is growing?  How are you measuring the leak?

Jared S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(4,523 Views)

Hi jareds,

 

Thanks for your reply. Sorry I forgot to mention that I am using LabVIEW 8.2.1. Every time I click load, the memory used by LabVIEW.exe increases (as measured by the Processes tab in Task Manager).

 

I would prefer not to upgrade my version of LabVIEW if possible. Do you have any insights?

 

Thanks,

-gpho

0 Kudos
Message 3 of 5
(4,517 Views)

Hi gpho,

 

I just tried this in 8.2.1 as well, but am still not getting a memory leak.  What version of Windows Media Player do you have?  What version of Windows as well?

Jared S.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(4,505 Views)
Solution
Accepted by topic author gpho

Hi jareds,

 

Thanks again for testing it for me. I am using Windows 7, and WMP version 12.

 

Since you had asked, I tested it on a computer with Windows XP and WMP version 9 (and LabVIEW 8.2.1), and the memory problem has disappeared. I then installed WMP version 11 on the same computer: still no memory problem.

 

On the Windows 7 computer, I reverted to version 11 using instructions found on this link, and the memory problem is gone. It seems that the memory leak is due to some problem with WMP version 12 (although the downgraded version 11 on windows 7 has some bugs - and you can't revert back to v12).

 

Thanks again for help!

-gpho

Message 5 of 5
(4,496 Views)