-1

We are running a WinForms app on a Windows 10 IoT Enterprise LTSC build 1809 that uses WMP.dll the current installed version is 12.0.17763.1821 and it seems when a audio/video file is repeated that over time it consume more and more memory and eventually will run out of memory. Resulting crashing apps.

Other Windows Build don't seem to have this issue:

  • Build 1607 LTSB with WMP version 12.0.14393.4169 runs without any issue.
  • Build 21H1 Pro with WMP version 12.0.19041.1151 runs without any issue.

Unfortunately because this is a LTSC version of Windows i cannot upgrade to a newer build and also cannot install any new WindowsMediaPlayer version (and they are out there) to debug this further.

So at this moment i'm stuck in how to move forward to solve this issue. And no we cannot drop WMP ;-)

Any help/ tips are appreciated.

Gforse
  • 323
  • 3
  • 20

1 Answers1

0

Have you tried explicitly freeing up the resources for the object on every "Play" event? Something like this may work:

string url = axWindowsMediaPlayer1.URL;
if (axWindowsMediaPlayer1 != null) axWindowsMediaPlayer1.Dispose();
axWindowsMediaPlayer1 = null;
System.GC.Collect();
axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
axWindowsMediaPlayer1.URL = url;

This stores the current URL in a string, wipes out the current WMP object, collects and frees up all used resources, and then creates a new WMP object to replace the former one, and sets the URL for it to the same as the URL of the old object... theoretically.

Westley Bennett
  • 554
  • 4
  • 19
  • 1
    You should check `(axWindowsMediaPlayer1 != null)` before evaluating the .URL property via `string url = axWindowsMediaPlayer1.URL;` – HardCode Oct 26 '21 at 16:58