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:21:17 +0000
commit50ca22510c2a64c11628f5c89eac5dd47ebc9f5f (patch)
tree7bf02d3a4c65cf49d0668582e4f2f299bcad916e
parent288b97bff81b13beba848602929d9254b3b4b150 (diff)
downloadunicorn-50ca22510c2a64c11628f5c89eac5dd47ebc9f5f.tar.gz
We need to add the array to ruby's global_list right after created it;
otherwise it probably gets GCed.

(cherry picked from commit e85de00a3065461f6fac466276d915b809f40c7c)
-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");