Another WMP 12 Large Tag Bug

Windows Media Player 12 has a massive memory leak when reading tags from MP3s, causing it to chew up all available system memory.

Probably the single biggest bug in the Windows 7 Beta was the MP3 corruption bug described in KB961367, which could cut a few seconds from the beginning of MP3 files that had sufficiently large tags. A patch for that bug was distributed via Windows Update to beta participants.

Windows Media Player

When adding my collection of MP3s to the WMP 12 library, I found that some files were not added correctly. They appeared in the library, but WMP displayed only the filename, instead of the title, artist, album, etc.

At first, I thought the MP3s had been corrupted by the earlier bug or otherwise. However, I found that adding just those files to the library worked fine. Windows Explorer also correctly read the tags. Looking into it further, I found that WMP 12 in the Windows 7 Beta has a massive memory leak when adding files to the library:

Windows Media Player memory usage

WMP appears to read the tags from the MP3s into memory, but never releases that memory after it’s done with the file. Since many of my MP3s have very large album art (several megabytes), WMP continues to chew up memory until it runs out. At that point, it continues to add the files to the library, but without reading out the tags.

Reproducing the Bug

If you don’t have enough MP3s with large album art and want to reproduce the bug, you can download this classic Leo Laporte podcast and add this 6.21 MB photo of Earth as album art. Then, copy the file 1000 or so times. You can use this PowerShell script to do so:

1..1000 | % {
    Copy-Item "TLR20060915.mp3" ("TLR20060915-" + $_ + ".mp3")
    Write-Output ("Copied TLR20060915-" + $_ + ".mp3")
}

Add the folder with those MP3s to your music library, start Windows Media Player, and watch the memory usage skyrocket.

Temporary Workaround

Fortunately, there is an easy fix you can use until Microsoft addresses the bug. When you start WMP for the first time, watch the memory usage in the Task Manager. If the memory usage gets too high, simply close WMP normally and start it again. WMP will resume scanning your library where it left off. You may have to repeat this multiple times, but WMP should add all the files without any problems this way.

If you tried to add your files before, you may need to delete the files in %USERPROFILE%\AppData\Local\Microsoft\Media Player first.

Tags: Windows 7, WMP