diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-01 23:15:51 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-01 23:15:51 +0000 |
commit | 9bc8642e1f366a35c305b9abe9e01bf934b584b9 (patch) | |
tree | 9c24ba1ebabff472b9caddbff07ef957dbf2c24c /boehm-gc/malloc.c | |
parent | 79eaf784f16b0e8079d9dca062a0fc959d289d18 (diff) | |
download | gcc-9bc8642e1f366a35c305b9abe9e01bf934b584b9.tar.gz |
Merged GC 5.0alpha4 with local changes, plus:
* Makefile.in: Rebuilt.
* Makefile.am (gctest_LDADD): Added THREADLIB.
(TESTS): New macro.
* configure: Rebuilt.
* configure.in (INCLUDES): New subst.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30332 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/malloc.c')
-rw-r--r-- | boehm-gc/malloc.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/boehm-gc/malloc.c b/boehm-gc/malloc.c index 41553b7f376..66e62d29694 100644 --- a/boehm-gc/malloc.c +++ b/boehm-gc/malloc.c @@ -93,8 +93,16 @@ register ptr_t *opp; if(GC_incremental && !GC_dont_gc) GC_collect_a_little_inner((int)n_blocks); lw = ROUNDED_UP_WORDS(lb); - while ((h = GC_allochblk(lw, k, 0)) == 0 - && GC_collect_or_expand(n_blocks, FALSE)); + h = GC_allochblk(lw, k, 0); +# ifdef USE_MUNMAP + if (0 == h) { + GC_merge_unmapped(); + h = GC_allochblk(lw, k, 0); + } +# endif + while (0 == h && GC_collect_or_expand(n_blocks, FALSE)) { + h = GC_allochblk(lw, k, 0); + } if (h == 0) { op = 0; } else { @@ -220,6 +228,9 @@ DCL_LOCK_STATE; /* * Thread initialisation can call malloc before * we're ready for it. + * It's not clear that this is enough to help matters. + * The thread implementation may well call malloc at other + * inopportune times. */ if (!GC_is_initialized) return sbrk(lb); # endif /* I386 && SOLARIS_THREADS */ @@ -375,6 +386,12 @@ int obj_kind; /* Required by ANSI. It's not my fault ... */ h = HBLKPTR(p); hhdr = HDR(h); +# if defined(REDIRECT_MALLOC) && \ + (defined(SOLARIS_THREADS) || defined(LINUX_THREADS)) + /* We have to redirect malloc calls during initialization. */ + /* Don't try to deallocate that memory. */ + if (0 == hhdr) return; +# endif knd = hhdr -> hb_obj_kind; sz = hhdr -> hb_sz; ok = &GC_obj_kinds[knd]; |