]>
granicus.if.org Git - gc/commit
Eliminate 'memory leak' code defect for scratch-allocated memory
Reuse memory allocated by GC_scratch_alloc and GET_MEM in GC heap
if possible.
* backgraph.c (push_in_progress): Replace in_progress_size==0 with
in_progress_space==NULL (to ensure BCOPY argument is non-NULL);
eliminate code duplication regarding GC_add_to_our_memory call;
call GC_scratch_recycle_no_gww (for old in_progress_space value) unless
GWW_VDB (and remove corresponding FIXME).
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Call GC_scratch_recycle_no_gww (for
old addr_map and current_sz values).
* include/private/gc_priv.h [!GWW_VDB] (GC_scratch_recycle_no_gww): New
internal macro.
* include/private/gc_priv.h (GC_scratch_recycle_inner): New prototype.
* mark.c (GC_scratch_recycle_inner): New function (move code portion
from alloc_mark_stack).
* mark.c (alloc_mark_stack): Call GC_scratch_recycle_inner (if
recycle_old).
* os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Call GC_scratch_recycle_no_gww
(for old maps_buf and maps_buf_sz values).
* os_dep.c [PROC_VDB] (GC_read_dirty): Call GC_scratch_recycle_no_gww
(for old GC_proc_buf and GC_proc_buf_size values).