Project

General

Profile

Actions

Bug #5058

closed

Memory leak in Psych.load

Added by nerdd (Rasmus Grouleff) over 13 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
Backport:
[ruby-core:38204]

Description

=begin
I believe there's a memory leak in (({Psych.load})) that affects all long running processes that loads YAML a large number of times.

The expected behaviour is that the memory consumption doesn't grow just because a very simple piece of YAML is loaded and immediately thrown away multiple times.

The easiest way to reproduce it is by executing the following piece of code in irb and look at the memory consumption of the process in a process monitor.

require 'psych'
(1..10000).each {|i| Psych.load "---\nhey\n...\n"}

The two pictures I've attached show what it looks like in my process monitor before and after.

I've run this on Mac OS X 10.6.8.

The compiler is: (({i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)}))

And I've used no ./configure options.
=end


Files

Screen_shot_2011-07-19_at_19.24.05.png (200 KB) Screen_shot_2011-07-19_at_19.24.05.png Before Psych.load nerdd (Rasmus Grouleff), 07/20/2011 03:05 AM
Screen_shot_2011-07-19_at_19.44.38.png (202 KB) Screen_shot_2011-07-19_at_19.44.38.png After 10,000 Psych.load nerdd (Rasmus Grouleff), 07/20/2011 03:05 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0