summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2007-10-24 02:38:41 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:41 +0200
commit6bd946e18d7ec227ee1c295b3d0122758c07511e (patch)
tree60a6fc4e77b22a7a0405344f43252b1176bb8a92 /malloc.c
parent68881a4d6f91e9876682da0c84345e6c6e01954a (diff)
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.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/malloc.c b/malloc.c
index 4795048..c03dc74 100644
--- 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);
}
}