There is no reason for using native extensions in scripting languages like Ruby when program load is pretty low (especially when they are used for performance reason, not binding). Great insight, though. Author described this experience as it was a great venture... in hindsight I suppose :-)
How I spent two weeks hunting a memory leak in Ruby (2015)
11–20 of 71 posts
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#12There is no reason for using native extensions in scripting languages like Ruby when program load is pretty low (especially when they are used for performance reason, not binding). Great insight, though. Author described this experience as it was a great venture... in hindsight I suppose :-)
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#13There is no reason for using native extensions in scripting languages like Ruby when program load is pretty low (especially when they are used for performance reason, not binding). Great insight, though. Author described this experience as it was a great venture... in hindsight I suppose :-)
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#14I had a similar issue that I was tracing last week that did end up being my Ruby code...and it turns out I was modifying a constant like in the example.
What a fun read! I've been learning more about Ruby's GC since 2.1 and this got me looking even deeper -- definitely picked up a couple of new tricks/tools from this. Thank you be9!
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#15I tried to add ASan to the travis config for this project but I couldn't quite figure out how to change CFLAGS and/or CC. Never used ruby but interwebs hinted that the bundle config/install commands might accept "--cc" and "--with-cflags" commands. It's ignored when I tried it though [1].
[1] https://travis-ci.org/androm3da/redcarpet/jobs/159711520
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#16About the patch at https://github.com/vmg/redcarpet/pull/516/files , couldn't the update simply have been the following? - return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, NULL, rndr); + return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, xfree, rndr);
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#17Earlier quoted context omitted.
> when program load is pretty low The leak was in a gem.
Gem is still library albeit its name.
2. With over 10M downloads, I assume at least some of them spend large percentages of time using it.
3. It's Markdown; replicating the idiosyncrasies of SmartyPants (https://daringfireball.net/projects/smartypants/) in a different language is not something many people are going to want to do.
I'm not saying that people should or should not use Redcarpet; just that it's unlikely that anyone engaged in "premature optimization" here.
Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#18Re: How I spent two weeks hunting a memory leak in Ruby (2015)
#19Ideally much less tooling would have been needed.