diff options
author | Christopher Faylor <me@cgf.cx> | 2011-11-29 15:34:49 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-11-29 15:34:49 +0000 |
commit | 480b13a37aa1ca2e8ef6135a6d8dd9462c3df30e (patch) | |
tree | a612763e4e2bbc4d5298581ea617b73e8af693cd /winsup/cygwin/cygheap.cc | |
parent | d1fc77322f7e413e2d717d006ffe0a55f913e2b2 (diff) | |
download | cygnal-480b13a37aa1ca2e8ef6135a6d8dd9462c3df30e.tar.gz cygnal-480b13a37aa1ca2e8ef6135a6d8dd9462c3df30e.tar.bz2 cygnal-480b13a37aa1ca2e8ef6135a6d8dd9462c3df30e.zip |
* sigproc.cc (remove_proc): Don't terminate the currently executing thread.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r-- | winsup/cygwin/cygheap.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 554375943..fabb68072 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -70,18 +70,22 @@ cygheap_fixup_in_child (bool execed) { cygheap->hooks.next = NULL; cygheap->user_heap.base = NULL; /* We can allocate the heap anywhere */ - /* Walk the allocated memory chain looking for orphaned memory from - previous execs */ - for (_cmalloc_entry *rvc = cygheap->chain; rvc; rvc = rvc->prev) - { - cygheap_entry *ce = (cygheap_entry *) rvc->data; - if (!rvc->ptr || rvc->b >= NBUCKETS || ce->type <= HEAP_1_START) - continue; - else if (ce->type < HEAP_1_MAX) - ce->type += HEAP_1_MAX; /* Mark for freeing after next exec */ - else - _cfree (ce); /* Marked by parent for freeing in child */ - } + } + /* Walk the allocated memory chain looking for orphaned memory from + previous execs or forks */ + for (_cmalloc_entry *rvc = cygheap->chain; rvc; rvc = rvc->prev) + { + cygheap_entry *ce = (cygheap_entry *) rvc->data; + if (!rvc->ptr || rvc->b >= NBUCKETS || ce->type <= HEAP_1_START) + continue; + else if (ce->type > HEAP_2_MAX) + _cfree (ce); /* Marked for freeing in any child */ + else if (!execed) + continue; + else if (ce->type > HEAP_1_MAX) + _cfree (ce); /* Marked for freeing in execed child */ + else + ce->type += HEAP_1_MAX; /* Mark for freeing after next exec */ } } |