From: "Eregon (Benoit Daloze)" Date: 2012-10-29T10:32:13+09:00 Subject: [ruby-core:48534] [ruby-trunk - Bug #6865] GC::Profiler.report might create a huge String and invoke a few GC cycles Issue #6865 has been updated by Eregon (Benoit Daloze). authorNari (Narihiro Nakamura) wrote: > This issue was solved with changeset r37343 by Eregon. > Thank you. Oh, sorry, I forgot to mention the issue in the commit log. I also meant to come back to this issue to thank you for the review and letting me commit it. ---------------------------------------- Bug #6865: GC::Profiler.report might create a huge String and invoke a few GC cycles https://bugs.ruby-lang.org/issues/6865#change-31903 Author: Eregon (Benoit Daloze) Status: Closed Priority: Normal Assignee: authorNari (Narihiro Nakamura) Category: core Target version: ruby -v: ruby 2.0.0dev (2012-08-10 trunk 36676) [x86_64-darwin10.8.0] Hi, In my use-case, GC::Profiler.report adds a few GC cycles to actually create the report, ending with these lines: 9317 26.279 185760 701760 17544 0.33300000000124896360 9318 26.282 185760 701760 17544 0.32800000000321460902 # start of GC::Profiler.report 9319 26.285 393400 701760 17544 0.82300000000046225068 9320 26.288 700480 718080 17952 1.43599999999821648089 9321 26.294 1254800 1272960 31824 2.69300000000072259354 ... 9331 26.907 43836160 43917120 1097928 81.77799999999990632205 This is likely expected with GC::Profiler.result, but I think it could be partly avoided by printing line by line in GC::Profiler.report. Maybe gc_profile_result() could accepts a String or IO as an argument and call #<< or similar ? I might have a try to solve this, but I'd be happy as well if someone solves it before me. The GC::Profiler class documentation should probably be updated to use GC::Profiler.report if it proves to be more efficient. -- http://bugs.ruby-lang.org/