Atom table leak after window running on a separate thread closes (Check the demo)
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: Not tested
* Windows version: Win10 20H2
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
**Problem description:**
If a window is started on a separate thread, after the window closes, the atom created using RegisterWindowMessage is not destroyed/released as long as the program is running. As the max atom table size is 16384, This will finally cause an outofmemory exception.
**Minimal repro:**
[openwindowInNewThread.zip](https://github.com/dotnet/wpf/files/5790088/openwindowInNewThread.zip)
Just run the demo above, and use [this tool](https://github.com/JordiCorbilla/atom-table-monitor) to monitor the atom table count. By opening and closing the new window (it's running on a separate thread) repeatedly, you can see the RWM atom count keeps rising, and falls down after the program exits.

Contributor guide
Assessment
This issue has not been assessed yet.