Hi folks,
There seems to be a perception that the Runtime Broker leak is inextricably tied to The Time at the moment, so I want to provide some additional information here since I imagine many people experiencing the leak will find there way to this thread via their
favorite search engine.
Users:
There's a bug in the Windows Runtime, the new platform that Windows Store (aka Metro) applications are written on, that causes the "Runtime Broker" process to take on additional memory but never release it, resulting in a memory leak. If you find that the
Runtime Broker process on your computer is taking an unreasonable amount of memory, consider the Windows Store applications you've installed recently that utilize Live Tiles. Try uninstalling them, one by one, until the Runtime Broker takes less memory. Note
that the reduction in memory may not be immediate and you may need to log out and back in to make it reset. (You
may be able to kill the Runtime Broker process safely, but I would advise against it.)
Developers:
The bug manifests itself when calling TileUpdater.GetScheduledTileNotifications. The leak may not be obvious unless you have many tiles scheduled. In my experience it happens regardless of the number of scheduled tiles, it's just more apparent
when you have more.
For example, consider the following scenario:
- Schedule 4,000 tile updates via TileUpdater.AddToSchedule. Note that the Runtime Broker's memory increases a bit. This is to be expected.
- Call TileUpdater.GetScheduledTileNotifications. Notice that the Runtime Broker's memory increases by a good amount. This is typically 30-40 MB on my machine.
- Now remove each notification via TileUpdater.RemoveFromSchedule. The Runtime Broker's memory stays the same.
- Schedule another 4,000 updates.
- Call TileUpdater.GetScheduledTileNotifications. Observe an increase in Runtime Broker memory use, similar to that in step 2.
- Keep repeating step 5, each time with the same amount of memory increase.
It appears that every call to TileUpdater.GetScheduledTileNotificaitons is resulting in the Runtime Broker allocating memory it never frees. Considering the Windows Runtime is partially based on COM I thought that perhaps it was up to the
developer to free up references to the tile notifications returned from the method. But the documentation says nothing about it and none of the classes implement IDisposable. The only option I'm aware of at this time is to avoid the method completely.
The bug has been entered into Microsoft Connect and you can follow its progress here:
http://connect.microsoft.com/VisualStudio/feedback/details/770619/memory-leak-in-runtime-broker
If you have any questions, please feel free to email me directly at jeffreykey at gmail.com.
Thanks,
Jeff