Created
November 28, 2012 06:49
-
-
Save mrkn/4159480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gc.c b/gc.c | |
index 01d908d..ba9726c 100644 | |
--- a/gc.c | |
+++ b/gc.c | |
@@ -2042,12 +2042,14 @@ finalize_list(rb_objspace_t *objspace, RVALUE *p) | |
RVALUE *tmp = p->as.free.next; | |
run_final(objspace, (VALUE)p); | |
if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */ | |
- if (objspace->heap.sweep_slots) { | |
- p->as.free.flags = 0; | |
- } | |
- else { | |
- GC_PROF_DEC_LIVE_NUM; | |
- add_freelist(objspace, p); | |
+ if ((VALUE)p != rb_thread_main()) { | |
+ if (objspace->heap.sweep_slots) { | |
+ p->as.free.flags = 0; | |
+ } | |
+ else { | |
+ GC_PROF_DEC_LIVE_NUM; | |
+ add_freelist(objspace, p); | |
+ } | |
} | |
} | |
else { | |
@@ -3048,7 +3050,8 @@ static int | |
chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg) | |
{ | |
RVALUE *p = (RVALUE *)key, **final_list = (RVALUE **)arg; | |
- if ((p->as.basic.flags & (FL_FINALIZE|FL_MARK)) == FL_FINALIZE) { | |
+ if ((p->as.basic.flags & (FL_FINALIZE|FL_MARK)) == FL_FINALIZE && | |
+ (VALUE)p != rb_thread_main()) { | |
if (BUILTIN_TYPE(p) != T_ZOMBIE) { | |
p->as.free.flags = FL_MARK | T_ZOMBIE; /* remain marked */ | |
RDATA(p)->dfree = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment