* 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>
+
+ * 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.
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;
*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();
}
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);
}
}