public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] malloc: Initiate tcache shutdown even without allocations [BZ #28028]
@ 2021-07-02 15:39 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2021-07-02 15:39 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dfec225ee1972488bb48a8b67a2c4a13010c334a
commit dfec225ee1972488bb48a8b67a2c4a13010c334a
Author: JeffyChen <jeffy.chen@rock-chips.com>
Date: Fri Jul 2 17:39:24 2021 +0200
malloc: Initiate tcache shutdown even without allocations [BZ #28028]
After commit 1e26d35193efbb29239c710a4c46a64708643320 ("malloc: Fix
tcache leak after thread destruction [BZ #22111]"),
tcache_shutting_down is still not early enough. When we detach a
thread with no tcache allocated, tcache_shutting_down would still be
false.
Reviewed-by: DJ Delorie <dj@redhat.com>
Diff:
---
malloc/malloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0e2e1747e0..bb9a1642aa 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3144,12 +3144,13 @@ tcache_thread_shutdown (void)
int i;
tcache_perthread_struct *tcache_tmp = tcache;
+ tcache_shutting_down = true;
+
if (!tcache)
return;
/* Disable the tcache and prevent it from being reinitialized. */
tcache = NULL;
- tcache_shutting_down = true;
/* Free all of the entries and the tcache itself back to the arena
heap for coalescing. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-02 15:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 15:39 [glibc] malloc: Initiate tcache shutdown even without allocations [BZ #28028] Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).