[PR #8617] Reduce Transient Allocations during Bulk Text Output #27256

Open
opened 2026-01-31 09:20:54 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/8617

State: closed
Merged: Yes


Make a few changes to memory usage throughout the application to reduce transient allocations from the big.txt test from ~213,000 to ~53,000.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Transient allocations are those that are new'd, used, then delete'd. Going back and forth to the system allocator for things we're just going to throw away or use rapidly again is a performance detriment. Not only is it a bunch of time to go ask the system with a syscall, it also hits a whole bunch of locks on the allocators. This PR identifies a few places where we were accidentally allocating and didn't mean to or were allocating and freeing just to turn around and allocate again. I chose other strategies to avoid this.

Validation Steps Performed

  • Ran big.txt sample (~6MB file) before and after. Observed heap allocations with WPR.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/8617 **State:** closed **Merged:** Yes --- Make a few changes to memory usage throughout the application to reduce transient allocations from the `big.txt` test from ~213,000 to ~53,000. ## PR Checklist * [x] Supports #3075 * [x] I work here. * [x] Tested manually and WPR'd. Test suite should still pass. * [x] Am core contributor ## Detailed Description of the Pull Request / Additional comments Transient allocations are those that are new'd, used, then delete'd. Going back and forth to the system allocator for things we're just going to throw away or use rapidly again is a performance detriment. Not only is it a bunch of time to go ask the system with a syscall, it also hits a whole bunch of locks on the allocators. This PR identifies a few places where we were accidentally allocating and didn't mean to or were allocating and freeing just to turn around and allocate again. I chose other strategies to avoid this. ## Validation Steps Performed - Ran `big.txt` sample (~6MB file) before and after. Observed heap allocations with WPR.
claunia added the pull-request label 2026-01-31 09:20:54 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27256