Created
July 5, 2015 07:14
-
-
Save nagachika/396fc77f95f0f4aac707 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
1. ruby extconf.rb | |
2. make | |
3. ruby test11328.rb | |
4. watch memory usage of 3. process | |
You should reproduce Makefile (step 1) if you try another version of ruby. |
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
#include "ruby/ruby.h" | |
static VALUE | |
bug_str_buf_cat(VALUE mod, VALUE str1, VALUE str2) | |
{ | |
(void)mod; | |
rb_str_cat(str1, RSTRING_PTR(str2), RSTRING_LEN(str2)); | |
return str1; | |
} | |
void | |
Init_bug11328(void) | |
{ | |
VALUE mBug11328 = rb_define_module("Bug11328"); | |
rb_define_singleton_method(mBug11328, "str_buf_cat", bug_str_buf_cat, 2); | |
} |
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
require "mkmf" | |
create_makefile("bug11328") |
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
require "./bug11328" | |
while true | |
str = "hello" | |
str2 = "foo" | |
10000.times do | |
Bug11328.str_buf_cat(str, str2) | |
end | |
GC.start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment