Skip to content
  • NARUSE, Yui's avatar
    3426ebd0
    merge revision(s) c6f84e91: [Backport #19398] · 3426ebd0
    NARUSE, Yui authored
    	[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
    	```
    	---
    	 gc.c                      | 1 +
    	 test/ruby/test_weakmap.rb | 9 +++++++++
    	 2 files changed, 10 insertions(+)
    3426ebd0
    merge revision(s) c6f84e91: [Backport #19398]
    NARUSE, Yui authored
    	[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
    	```
    	---
    	 gc.c                      | 1 +
    	 test/ruby/test_weakmap.rb | 9 +++++++++
    	 2 files changed, 10 insertions(+)
Loading