aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/malloc.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1999-11-01 23:15:51 +0000
committerTom Tromey <tromey@gcc.gnu.org>1999-11-01 23:15:51 +0000
commit20bbd3cd53a80ddafa56a5d21337aae0c24f94ca (patch)
tree9c24ba1ebabff472b9caddbff07ef957dbf2c24c /boehm-gc/malloc.c
parentc05ddfa745d68f6d9db1a7d0992650a41986d376 (diff)
downloadgcc-20bbd3cd53a80ddafa56a5d21337aae0c24f94ca.zip
gcc-20bbd3cd53a80ddafa56a5d21337aae0c24f94ca.tar.gz
gcc-20bbd3cd53a80ddafa56a5d21337aae0c24f94ca.tar.bz2
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. From-SVN: r30332
Diffstat (limited to 'boehm-gc/malloc.c')
-rw-r--r--boehm-gc/malloc.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/boehm-gc/malloc.c b/boehm-gc/malloc.c
index 41553b7..66e62d2 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];