Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2022-08-23 11:59:18 +0300
committerCorinna Vinschen <corinna@vinschen.de>2022-08-23 13:09:44 +0300
commit63b503916d4258cec39df09c545498e463d9a088 (patch)
tree7fd0e5a0814610116a2b2e81d9bdecdcaa6e419f /winsup/cygwin/cygtls.cc
parent64a11fded15b92b56b91d65fd5b2851245f69299 (diff)
Cygwin: tls_pathbuf: Use Windows heap
Rather than using malloc/free for the buffers, we're now using HeapAlloc/HeapFree on a HEAP_NO_SERIALIZE heap created for this thread. Advantages: - Less contention. Our malloc/free doesn't scale well in multithreaded scenarios - Even faster heap allocation by using a non serialized heap. - Internal, local, temporary data not cluttering the user heap. - Internal, local, temporary data not copied over to child process at fork(). Disadvantage: - A forked process has to start allocating temporary buffers from scratch. However, this should be alleviated by the fact that buffer allocation usually reaches its peak very early in process runtime, so the longer the proceess runs, the less buffers have to allocated, and, only few processes don't exec after fork anyway. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r--winsup/cygwin/cygtls.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index cf3a7daba..afaee8e97 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -64,6 +64,7 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *))
initialized = CYGTLS_INITIALIZED;
errno_addr = &(local_clib._errno);
locals.cw_timer = NULL;
+ locals.pathbufs.clear ();
if ((void *) func == (void *) cygthread::stub
|| (void *) func == (void *) cygthread::simplestub)
@@ -84,6 +85,7 @@ _cygtls::fixup_after_fork ()
signal_arrived = NULL;
locals.select.sockevt = NULL;
locals.cw_timer = NULL;
+ locals.pathbufs.clear ();
wq.thread_ev = NULL;
}