GC_bytes_allocd += GRANULES_TO_BYTES(lg);
} else {
op = (ptr_t)GC_alloc_large_and_clear(ADD_SLOP(lb), k, 0);
- GC_bytes_allocd += lb;
+ if (op != NULL)
+ GC_bytes_allocd += lb;
}
return op;
GC_ASSERT(k < MAXOBJKINDS);
lb_adjusted = ADD_SLOP(lb);
op = GC_alloc_large_and_clear(lb_adjusted, k, IGNORE_OFF_PAGE);
- GC_bytes_allocd += lb_adjusted;
+ if (op != NULL)
+ GC_bytes_allocd += lb_adjusted;
return op;
}
#endif
((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0;
# endif
}
+ GC_bytes_allocd += lb_rounded;
}
- GC_bytes_allocd += lb_rounded;
UNLOCK();
if (init && !GC_debugging_started && 0 != result) {
BZERO(result, n_blocks * HBLKSIZE);
GC_DBG_COLLECT_AT_MALLOC(lb);
LOCK();
result = (ptr_t)GC_alloc_large(ADD_SLOP(lb), k, IGNORE_OFF_PAGE);
- if (0 != result) {
- if (GC_debugging_started) {
- BZERO(result, n_blocks * HBLKSIZE);
- } else {
-# ifdef THREADS
- /* Clear any memory that might be used for GC descriptors */
- /* before we release the lock. */
- ((word *)result)[0] = 0;
- ((word *)result)[1] = 0;
- ((word *)result)[GRANULES_TO_WORDS(lg)-1] = 0;
- ((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0;
-# endif
- }
- }
- GC_bytes_allocd += lb_rounded;
- if (0 == result) {
+ if (NULL == result) {
GC_oom_func oom_fn = GC_oom_fn;
UNLOCK();
- return((*oom_fn)(lb));
+ return (*oom_fn)(lb);
+ }
+
+ if (GC_debugging_started) {
+ BZERO(result, n_blocks * HBLKSIZE);
} else {
- UNLOCK();
- if (init && !GC_debugging_started) {
- BZERO(result, n_blocks * HBLKSIZE);
- }
- return(result);
+# ifdef THREADS
+ /* Clear any memory that might be used for GC descriptors */
+ /* before we release the lock. */
+ ((word *)result)[0] = 0;
+ ((word *)result)[1] = 0;
+ ((word *)result)[GRANULES_TO_WORDS(lg)-1] = 0;
+ ((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0;
+# endif
+ }
+ GC_bytes_allocd += lb_rounded;
+ UNLOCK();
+ if (init && !GC_debugging_started) {
+ BZERO(result, n_blocks * HBLKSIZE);
}
+ return(result);
}
GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_ignore_off_page(size_t lb)