summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2007-08-04 06:26:29 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:41 +0400
commit87b2e2602e766e448e7d65d7a7a7eb3e3cd020cb (patch)
tree0162d9d9de90bf1acb3653e4876d39b0e52d6439 /headers.c
parent6db625e8a2a7d5d8b4faf8747b5688cd64f3949e (diff)
downloadbdwgc-87b2e2602e766e448e7d65d7a7a7eb3e3cd020cb.tar.gz
2007-08-03 Hans Boehm <Hans.Boehm@hp.com>
* alloc.c, backgraph.c, headers.c, include/private/gc_priv.h: Maintain GC_our_memory and GC_n_memory. * dbg_mlc.c (GC_print_smashed_obj): Improve message. (GC_print_all_smashed_proc): Pass client object address instead of base. * dyn_load.c (sort_heap_sects): New. (GC_register_map_entries): Register sections that are contiguous and merged with our heap. * malloc.c, os_dep.c (GC_text_mapping): Check for just base name of libraries. * malloc.c (calloc): Check for special callers even with USE_PROC_FOR_LIBRARIES. Move assertion. Add rudimentary malloc/free tracing. * misc.c: No longer call GC_init_lib_bounds explicitly. * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Always initialize on demand. * tests/test.c: Call GC_INIT only when required.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/headers.c b/headers.c
index 6b4eb849..7aef710d 100644
--- a/headers.c
+++ b/headers.c
@@ -132,11 +132,13 @@ ptr_t GC_scratch_alloc(size_t bytes)
bytes_to_get &= ~(GC_page_size - 1);
# endif
result = (ptr_t)GET_MEM(bytes_to_get);
+ GC_add_to_our_memory(result, bytes_to_get);
scratch_free_ptr -= bytes;
GC_scratch_last_end_ptr = result + bytes;
return(result);
}
result = (ptr_t)GET_MEM(bytes_to_get);
+ GC_add_to_our_memory(result, bytes_to_get);
if (result == 0) {
if (GC_print_stats)
GC_printf("Out of memory - trying to allocate less\n");
@@ -146,7 +148,9 @@ ptr_t GC_scratch_alloc(size_t bytes)
bytes_to_get += GC_page_size - 1;
bytes_to_get &= ~(GC_page_size - 1);
# endif
- return((ptr_t)GET_MEM(bytes_to_get));
+ result = (ptr_t)GET_MEM(bytes_to_get);
+ GC_add_to_our_memory(result, bytes_to_get);
+ return result;
}
scratch_free_ptr = result;
GC_scratch_end_ptr = scratch_free_ptr + bytes_to_get;