runtime: force the garbage collector to run when a thread exits

This is a first attempt to improve the memory usage reported in
issue #534.
This commit is contained in:
Yorick Hardy 2024-11-15 23:02:55 +02:00
parent d8aa289af4
commit 955695f554

View file

@ -7181,6 +7181,7 @@ void Cyc_exit_thread(void *data, object _, int argc, object * args)
gc_remove_mutator(thd); gc_remove_mutator(thd);
ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_RUNNABLE, ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_RUNNABLE,
CYC_THREAD_STATE_TERMINATED); CYC_THREAD_STATE_TERMINATED);
gc_force();
pthread_exit(NULL); pthread_exit(NULL);
} }