-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux/Threads: Fixes a stack memory leak for pthreads
Same situation as the last stack leak memory fix, this is fairly tricky since it is dealing with stack pivoting. Fixes the memory leak around pthread stack allocations, making memory usage lower for applications that constantly spin-up and destroy threads (Like Steam). We need to let glibc allocate a minimum sized stack (128KB and we can't control it) to work around a race condition with DTV/TLS regions. This means we need to do a stack pivot once the thread starts executing. We also need to be careful because the `PThread` object is deleted inside of the execution thread, which was resulting in a use-after-free bug. There are definitely some more memory leaks that I'm still fighting, and I have noticed in my abusive thread creation program that we might want to change some jemalloc options to more aggressively cut down on residency. This is just one out of many.
- Loading branch information
1 parent
002ca36
commit ea31363
Showing
1 changed file
with
85 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters