Commit bebeb0d1 authored by Niels Möller's avatar Niels Möller
Browse files

(gc_final): Always define gc_fianl, and kill the

resources in the root set. Deallocation and checks for leaks is
still done only when DEBUG_ALLOC is defined.

Rev: src/gc.c:1.23
Rev: src/gc.h:1.10
parent 57e0a2e9
...@@ -242,16 +242,18 @@ void gc_maybe(int busy) ...@@ -242,16 +242,18 @@ void gc_maybe(int busy)
} }
} }
#if DEBUG_ALLOC
/* Deallocate all objects. */ /* Deallocate all objects. */
#if DEBUG_ALLOC
int gc_final_p = 0; int gc_final_p = 0;
#endif
void gc_final(void) void gc_final(void)
{ {
KILL_RESOURCE_LIST(root_set); KILL_RESOURCE_LIST(root_set);
root_set = NULL; root_set = NULL;
#if DEBUG_ALLOC
gc_final_p = 1; gc_final_p = 1;
gc_sweep(); gc_sweep();
...@@ -265,5 +267,5 @@ void gc_final(void) ...@@ -265,5 +267,5 @@ void gc_final(void)
werror(" clue: %z\n", s->header.clue); werror(" clue: %z\n", s->header.clue);
fatal("gc_final: Internal error!\n"); fatal("gc_final: Internal error!\n");
} }
}
#endif /* DEBUG_ALLOC */ #endif /* DEBUG_ALLOC */
}
...@@ -38,9 +38,8 @@ void gc_maybe(int busy); ...@@ -38,9 +38,8 @@ void gc_maybe(int busy);
#if DEBUG_ALLOC #if DEBUG_ALLOC
extern int gc_final_p; extern int gc_final_p;
void gc_final(void);
#else
#define gc_final()
#endif #endif
void gc_final(void);
#endif /* LSH_GC_H_INCLUDED */ #endif /* LSH_GC_H_INCLUDED */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment