diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2023-03-27 13:55:43 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2023-03-28 08:20:06 -0400 |
| commit | 417b1a36447cb2c650de55b433ba623541fb8bb3 (patch) | |
| tree | d364bf0939fb219ee6d00260c66d06d9b799a235 /spec/ruby/core/numeric | |
| parent | 6ce6b4d1e7a6f6f20b232e8fc744c303bfd87098 (diff) | |
Fix memory leak for iclass
[Bug #19550]
If !RCLASS_EXT_EMBEDDED (e.g. 32 bit systems) then the rb_classext_t is
allocated throug malloc so it must be freed.
The issue can be seen in the following script:
```
20.times do
100_000.times do
mod = Module.new
Class.new do
include mod
end
end
# Output the Resident Set Size (memory usage, in KB) of the current Ruby process
puts `ps -o rss= -p #{$$}`
end
```
Before this fix, the max RSS is 280MB, while after this change, it's
30MB.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7597
Diffstat (limited to 'spec/ruby/core/numeric')
0 files changed, 0 insertions, 0 deletions
