diff options
Diffstat (limited to 'include/kpl/allocate.h')
| -rw-r--r-- | include/kpl/allocate.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/kpl/allocate.h b/include/kpl/allocate.h index ee24d72..3da4a10 100644 --- a/include/kpl/allocate.h +++ b/include/kpl/allocate.h @@ -19,6 +19,7 @@ inline void *kpl_object_allocate(kpl_thread *thread, int32_t size) { if (thread->gc_head) thread->gc_head->gc_prev = obj; thread->gc_head = obj; + thread->gc_cycle_change++; return obj; } @@ -31,5 +32,7 @@ inline void kpl_object_return(kpl_env *env, void *object) { obj->gc_prev->gc_next = obj->gc_next; if (obj->gc_next) obj->gc_next->gc_prev = obj->gc_prev; - kpl_memory_allocator_return(&env->threads[obj->thread_id].memory_allocator, object); + kpl_thread *thread = &env->threads[obj->thread_id]; + kpl_memory_allocator_return(&thread->memory_allocator, object); + thread->gc_cycle_change--; } |
