about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorXuanzhong Wei <azrlew@gmail.com>2017-10-03 23:57:18 +0900
committerEric Wong <e@80x24.org>2017-10-03 17:04:07 +0000
commite85de00a3065461f6fac466276d915b809f40c7c (patch)
tree35f2ff4bd49b03b0cf66a6a9bf35a8fb570a1979
parentcb1337800dfaeaa0134e8c2a40815fd9174bf55a (diff)
downloadunicorn-e85de00a3065461f6fac466276d915b809f40c7c.tar.gz
We need to add the array to ruby's global_list right after created it;
otherwise it probably gets GCed.
-rw-r--r--ext/unicorn_http/unicorn_http.rl2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 6fc3498..357440b 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -921,6 +921,7 @@ void Init_unicorn_http(void)
   VALUE mUnicorn, cHttpParser;
 
   mark_ary = rb_ary_new();
+  rb_global_variable(&mark_ary);
   mUnicorn = rb_define_module("Unicorn");
   cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
   eHttpParserError =
@@ -976,7 +977,6 @@ void Init_unicorn_http(void)
   init_unicorn_httpdate(mark_ary);
 
   OBJ_FREEZE(mark_ary);
-  rb_global_variable(&mark_ary);
 
 #ifndef HAVE_RB_HASH_CLEAR
   id_clear = rb_intern("clear");