mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 16:57:35 +02:00
Fixes to debug code
This commit is contained in:
parent
44dd3de7ac
commit
09807899d0
1 changed files with 11 additions and 7 deletions
18
gc.c
18
gc.c
|
@ -1002,7 +1002,7 @@ void gc_mut_cooperate(gc_thread_data * thd, int buf_len)
|
||||||
(cached_heap_free_sizes[HEAP_REST] <
|
(cached_heap_free_sizes[HEAP_REST] <
|
||||||
cached_heap_total_sizes[HEAP_REST] * GC_COLLECTION_THRESHOLD))) {
|
cached_heap_total_sizes[HEAP_REST] * GC_COLLECTION_THRESHOLD))) {
|
||||||
#if GC_DEBUG_TRACE
|
#if GC_DEBUG_TRACE
|
||||||
fprintf(stdout,
|
fprintf(stderr,
|
||||||
"Less than %f%% of the heap is free, initiating collector\n",
|
"Less than %f%% of the heap is free, initiating collector\n",
|
||||||
100.0 * GC_COLLECTION_THRESHOLD);
|
100.0 * GC_COLLECTION_THRESHOLD);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1289,7 +1289,7 @@ void debug_dump_globals();
|
||||||
void gc_collector()
|
void gc_collector()
|
||||||
{
|
{
|
||||||
int old_clear, old_mark, heap_type;
|
int old_clear, old_mark, heap_type;
|
||||||
size_t freed = 0;
|
size_t freed_tmp = 0, freed = 0;
|
||||||
#if GC_DEBUG_TRACE
|
#if GC_DEBUG_TRACE
|
||||||
size_t total_size;
|
size_t total_size;
|
||||||
size_t total_free;
|
size_t total_free;
|
||||||
|
@ -1336,17 +1336,21 @@ void gc_collector()
|
||||||
ck_pr_cas_int(&gc_stage, STAGE_TRACING, STAGE_SWEEPING);
|
ck_pr_cas_int(&gc_stage, STAGE_TRACING, STAGE_SWEEPING);
|
||||||
//
|
//
|
||||||
//sweep :
|
//sweep :
|
||||||
gc_sweep(gc_get_heap()->heap, HEAP_REST, &freed);
|
gc_sweep(gc_get_heap()->heap, HEAP_REST, &freed_tmp);
|
||||||
gc_sweep(gc_get_heap()->small_obj_heap, HEAP_SM, &freed);
|
freed += freed_tmp;
|
||||||
gc_sweep(gc_get_heap()->medium_obj_heap, HEAP_MED, &freed);
|
gc_sweep(gc_get_heap()->small_obj_heap, HEAP_SM, &freed_tmp);
|
||||||
gc_sweep(gc_get_heap()->huge_obj_heap, HEAP_HUGE, &freed);
|
freed += freed_tmp;
|
||||||
|
gc_sweep(gc_get_heap()->medium_obj_heap, HEAP_MED, &freed_tmp);
|
||||||
|
freed += freed_tmp;
|
||||||
|
gc_sweep(gc_get_heap()->huge_obj_heap, HEAP_HUGE, &freed_tmp);
|
||||||
|
freed += freed_tmp;
|
||||||
|
|
||||||
// TODO: this loop only includes smallest 2 heaps, is that sufficient??
|
// TODO: this loop only includes smallest 2 heaps, is that sufficient??
|
||||||
for (heap_type = 0; heap_type < 2; heap_type++) {
|
for (heap_type = 0; heap_type < 2; heap_type++) {
|
||||||
while (cached_heap_free_sizes[heap_type] <
|
while (cached_heap_free_sizes[heap_type] <
|
||||||
(cached_heap_total_sizes[heap_type] * GC_FREE_THRESHOLD)) {
|
(cached_heap_total_sizes[heap_type] * GC_FREE_THRESHOLD)) {
|
||||||
#if GC_DEBUG_TRACE
|
#if GC_DEBUG_TRACE
|
||||||
fprintf(stdout, "Less than %f%% of the heap %d is free, growing it\n",
|
fprintf(stderr, "Less than %f%% of the heap %d is free, growing it\n",
|
||||||
100.0 * GC_FREE_THRESHOLD, heap_type);
|
100.0 * GC_FREE_THRESHOLD, heap_type);
|
||||||
#endif
|
#endif
|
||||||
if (heap_type == HEAP_SM) {
|
if (heap_type == HEAP_SM) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue