]> granicus.if.org Git - gc/commitdiff
2007-10-23 Hans Boehm <Hans.Boehm@hp.com>
authorhboehm <hboehm>
Wed, 24 Oct 2007 00:38:41 +0000 (00:38 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:41 +0000 (21:06 +0400)
* malloc.c: Update GC_large_allocd_bytes on explicit deallocation.
* allchblk.c: Sanity check GC_max_large_allocd_bytes.

ChangeLog
allchblk.c
malloc.c

index 18cb8e45b54783e731b803996d55da13f5272f43..b3fa4f504f19fb6a910a4d63bb17e1323969a7ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-23  Hans Boehm <Hans.Boehm@hp.com>
+
+       * malloc.c: Update GC_large_allocd_bytes on explicit deallocation.
+       * allchblk.c: Sanity check GC_max_large_allocd_bytes.
+
 2007-10-23  Hans Boehm <Hans.Boehm@hp.com> (Really Manuel Serrano)
 
        * Makefile.direct: Invoke $(MAKE) instead of make.
index 0cec29d60e2b29cdaed211a74a49700aa511ae4a..807a703b1ded688135f74533d9b4b897a691ff78 100644 (file)
@@ -59,6 +59,8 @@ struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 };
   static GC_bool GC_enough_large_bytes_left(word bytes, int n)
   {
     int i;
+
+    GC_ASSERT(GC_max_large_allocd_bytes <= GC_heapsize);
     for (i = N_HBLK_FLS; i >= n; --i) {
        bytes += GC_free_bytes[i];
        if (bytes > GC_max_large_allocd_bytes) return TRUE;
index 4795048955e0dda2091982e68151fae2e71729ad..c03dc741b4e91053050c7e6ea4eeb03a74859c41 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -438,9 +438,13 @@ void GC_free(void * p)
        *flh = (ptr_t)p;
        UNLOCK();
     } else {
+        size_t nblocks = OBJ_SZ_TO_BLOCKS(sz);
         LOCK();
         GC_bytes_freed += sz;
        if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz;
+       if (nblocks > 1) {
+         GC_large_allocd_bytes -= nblocks * HBLKSIZE;
+       }  
         GC_freehblk(h);
         UNLOCK();
     }
@@ -477,8 +481,12 @@ void GC_free_inner(void * p)
        obj_link(p) = *flh;
        *flh = (ptr_t)p;
     } else {
+        size_t nblocks = OBJ_SZ_TO_BLOCKS(sz);
         GC_bytes_freed += sz;
        if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz;
+       if (nblocks > 1) {
+         GC_large_allocd_bytes -= nblocks * HBLKSIZE;
+       }
         GC_freehblk(h);
     }
 }