diff options
| author | Paul Buetow <paul@buetow.org> | 2008-10-14 20:38:27 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-10-14 20:38:27 +0000 |
| commit | d527f50159f056dc165fa7eaf7bf80425a1e758d (patch) | |
| tree | 03e8aa97c25fbc014876e5113dd66d4a44adac4d /src/core/garbage.c | |
| parent | 71185ab0ab0b08b4d5bb2e750ff85e11f105a453 (diff) | |
GC removed, temporaly
Diffstat (limited to 'src/core/garbage.c')
| -rw-r--r-- | src/core/garbage.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/garbage.c b/src/core/garbage.c index aba19c4..3820144 100644 --- a/src/core/garbage.c +++ b/src/core/garbage.c @@ -65,6 +65,12 @@ _garbage_print(_Garbage *p_garbage) { } void +_garbage_free(_Garbage *p_garbage) { + (*p_garbage->p_func) (p_garbage->p_2free); + free(p_garbage); +} + +void garbage_destroy() { garbage_collect(); @@ -87,17 +93,18 @@ garbage_destroy() { int garbage_collect() { + //printf("GARBAGE_COLLECT\n"); ListIterator *p_iter = listiterator_new(LIST_GARBAGE); List *p_list_garbage_new = list_new(); int i_count = 0; + //printf("size %d\n", list_size(LIST_GARBAGE)); while (listiterator_has_next(p_iter)) { _Garbage *p_garbage = listiterator_next(p_iter); if (p_garbage->p_ref_count == NULL || *p_garbage->p_ref_count <= 0) { - // _garbage_print(p_garbage); - (*p_garbage->p_func) (p_garbage->p_2free); - free(p_garbage); + //_garbage_print(p_garbage); + _garbage_free(p_garbage); ++i_count; } else { @@ -106,9 +113,9 @@ garbage_collect() { } listiterator_delete(p_iter); - list_delete(LIST_GARBAGE); LIST_GARBAGE = p_list_garbage_new; + //printf("GARBAGE_COLLECT_END\n"); return (i_count); } |
