Skip to content

Instantly share code, notes, and snippets.

@k-tsj
Created March 31, 2014 15:04
Show Gist options
  • Save k-tsj/9894424 to your computer and use it in GitHub Desktop.
Save k-tsj/9894424 to your computer and use it in GitHub Desktop.
Patch for SymbolGC SEGV
diff --git a/parse.y b/parse.y
index 3f756ce..680242d 100644
--- a/parse.y
+++ b/parse.y
@@ -10705,7 +10705,13 @@ rb_str_dynamic_intern(VALUE str)
ID id, type;
if (st_lookup(global_symbols.sym_id, str, &id)) {
- return ID2SYM(id);
+ VALUE sym = ID2SYM(id);
+ if (!STATIC_SYM_P(sym)) {
+ /* because of lazy sweep, dynamic symbol may be unmarked already and swept
+ * at next time */
+ rb_gc_resurrect(sym);
+ }
+ return sym;
}
enc = rb_enc_get(str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment