From: "caracal (Taishi Kasuga) via ruby-core" Date: 2023-09-10T05:56:36+00:00 Subject: [ruby-core:114674] [Ruby master Misc#19870] Why is a long-run thread allocated more memory than a short-run one? Issue #19870 has been reported by caracal (Taishi Kasuga). ---------------------------------------- Misc #19870: Why is a long-run thread allocated more memory than a short-run one? https://bugs.ruby-lang.org/issues/19870 * Author: caracal (Taishi Kasuga) * Status: Open * Priority: Normal ---------------------------------------- I want to write multithreading programing in Ruby but I found the following memory consumptions. ``` $ irb irb(main):001> require 'objspace' => true irb(main):002> t1 = Thread.new {} => # irb(main):003> t2 = Thread.new { sleep 6000 } => # irb(main):004> t3 = Thread.new { loop { sleep 5 } } => # irb(main):005> ObjectSpace.memsize_of(t1) => 360 irb(main):006> ObjectSpace.memsize_of(t2) => 1048936 irb(main):007> ObjectSpace.memsize_of(t3) => 1048936 irb(main):008> ``` Is the above behavior legitimate? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/