[#114774] [Ruby master Feature#19884] Make Safe Navigation Operator work on classes — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>
Issue #19884 has been reported by p8 (Petrik de Heus).
13 messages
2023/09/15
[ruby-core:114676] [Ruby master Misc#19870] Why is a long-run thread allocated more memory than a short-run one?
From:
"nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>
Date:
2023-09-10 12:56:28 UTC
List:
ruby-core #114676
Issue #19870 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Feedback
1048936 - 360 = 1048576 = 0x100000
A terminated thread no longer keeps its stack area.
----------------------------------------
Misc #19870: Why is a long-run thread allocated more memory than a short-run one?
https://bugs.ruby-lang.org/issues/19870#change-104505
* Author: caracal (Taishi Kasuga)
* Status: Feedback
* 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 {}
=> #<Thread:0x00007f9237a74b28 (irb):2 run>
irb(main):003> t2 = Thread.new { sleep 6000 }
=> #<Thread:0x00007f9237b4f1d8 (irb):3 run>
irb(main):004> t3 = Thread.new { loop { sleep 5 } }
=> #<Thread:0x00007f9237b6d840 (irb):4 run>
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/