Investigate memory leak over time #1054

Closed
opened 2026-01-30 22:15:25 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (May 14, 2019).

From discussion in #745

I do not have very concrete data on it yet, but I also see a massive memory leak in WindowsTerminal.exe, even with only ever having just one tab open.
I tend to see this memory consumption happen most aggressively with any sort of application that continuously updates the screen like mtr or htop (I'm using the version of OpenSSH bundled with Windows build 18362 to connect to a Linux machine to run these). A session that run for just under 40 minutes got up to over 1000 MB of memory usage according to Task Manager.

Another bit of information, all that memory seems to be released over time, that same session, now sitting at a shell over SSH calms down and now roughly 3 hours later, it is using an efficient and trim 8.5 MB of RAM according to Task Manager.

Originally created by @zadjii-msft on GitHub (May 14, 2019). From discussion in #745 > I do not have very concrete data on it yet, but I also see a massive memory leak in WindowsTerminal.exe, even with only ever having just one tab open. I tend to see this memory consumption happen most aggressively with any sort of application that continuously updates the screen like mtr or htop (I'm using the version of OpenSSH bundled with Windows build 18362 to connect to a Linux machine to run these). A session that run for just under 40 minutes got up to over 1000 MB of memory usage according to Task Manager. > Another bit of information, all that memory seems to be released over time, that same session, now sitting at a shell over SSH calms down and now roughly 3 hours later, it is using an efficient and trim 8.5 MB of RAM according to Task Manager.
Author
Owner

@Robo210 commented on GitHub (May 29, 2019):

It looks like at least one stack that's doing constant allocations is

Commit Stack Size (MB)
[Root] 3.609
ntdll.dll!RtlUserThreadStart 3.609
kernel32.dll!BaseThreadInitThunk 3.609
TerminalControl.dll!Microsoft::Console::Render::RenderThread::s_ThreadProc 3.609
TerminalControl.dll!Microsoft::Console::Render::Renderer::PaintFrame 3.609
TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintFrameForEngine 3.609
TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintBufferOutput 3.609
TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintBufferOutputHelper 3.609
TerminalControl.dll!Microsoft::Console::Render::DxEngine::PaintBufferLine 3.609
TerminalControl.dll!Microsoft::Console::Render::CustomTextLayout::_AnalyzeRuns 3.609
|- TerminalControl.dll!Microsoft::Console::Render::CustomTextLayout::_AnalyzeFontFallback 3.133
|    DWrite.dll!DWriteFontFallback::MapCharacters 3.133
|    DWrite.dll!FontFallback::MapCharacters 3.133
|    |- DWrite.dll!MatchFamilyToText 1.641
|    |- DWrite.dll!GetFontFamily 1.492

This came from 10 seconds of tracing while a progress bar was being printed to the console.

@Robo210 commented on GitHub (May 29, 2019): It looks like at least one stack that's doing constant allocations is |Commit Stack | Size (MB)| |-- | --| [Root] | 3.609 ntdll.dll!RtlUserThreadStart | 3.609 kernel32.dll!BaseThreadInitThunk | 3.609 TerminalControl.dll!Microsoft::Console::Render::RenderThread::s_ThreadProc | 3.609 TerminalControl.dll!Microsoft::Console::Render::Renderer::PaintFrame | 3.609 TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintFrameForEngine | 3.609 TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintBufferOutput | 3.609 TerminalControl.dll!Microsoft::Console::Render::Renderer::_PaintBufferOutputHelper | 3.609 TerminalControl.dll!Microsoft::Console::Render::DxEngine::PaintBufferLine | 3.609 TerminalControl.dll!Microsoft::Console::Render::CustomTextLayout::_AnalyzeRuns | 3.609 \|- TerminalControl.dll!Microsoft::Console::Render::CustomTextLayout::_AnalyzeFontFallback | 3.133 \|    DWrite.dll!DWriteFontFallback::MapCharacters | 3.133 \|    DWrite.dll!FontFallback::MapCharacters | 3.133 \|    \|- DWrite.dll!MatchFamilyToText | 1.641 \|    \|- DWrite.dll!GetFontFamily | 1.492 This came from 10 seconds of tracing while a progress bar was being printed to the console.
Author
Owner

@Biswa96 commented on GitHub (May 30, 2019):

How did you find?

@Biswa96 commented on GitHub (May 30, 2019): How did you find?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1054