Actions
Bug #19398
closedMemory leak in WeakMap
Description
Pull request: https://github.com/ruby/ruby/pull/7223
There's a memory leak in ObjectSpace::WeakMap due to not freeing the struct weakmap
. It can be seen in the following script:
100.times do
10000.times do
ObjectSpace::WeakMap.new
end
# Output the Resident Set Size (memory usage, in KB) of the current Ruby process
puts `ps -o rss= -p #{$$}`
end
This is the memory usage graph before and after the patch:
Files
Updated by peterzhu2118 (Peter Zhu) about 2 years ago
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
Updated by peterzhu2118 (Peter Zhu) about 2 years ago
- Status changed from Open to Closed
Applied in changeset git|c6f84e918943a0bf8db6fee556fc53180d257510.
[Bug #19398] Memory leak in WeakMap
There's a memory leak in ObjectSpace::WeakMap due to not freeing
the struct weakmap
. It can be seen in the following script:
100.times do
10000.times do
ObjectSpace::WeakMap.new
end
# Output the Resident Set Size (memory usage, in KB) of the current Ruby process
puts `ps -o rss= -p #{$$}`
end
Updated by naruse (Yui NARUSE) almost 2 years ago
- Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE
ruby_3_2 3426ebd0489654f951a8b92efaf5e72b9f43efab merged revision(s) c6f84e918943a0bf8db6fee556fc53180d257510.
Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago
- Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE, 3.2: DONE
ruby_3_1 0d00732d39de1e5ecce738260a1e49d8af52e12a merged revision(s) c6f84e918943a0bf8db6fee556fc53180d257510.
Actions
Like0
Like0Like0Like0Like0