Project

General

Profile

Actions

Bug #20311

closed

Struct.new("A") memory leak?

Added by MaxLap (Maxime Lapointe) 3 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:52069]

Description

The following code gives the impression of a memory leak.

10.times do
  5000.times do
    Struct.new("A")
    Struct.send(:remove_const, :A)
  end

  GC.start
  puts `ps -o rss= -p #{$$}`.to_i
end
27868
35324
43400
51472
58676
66144
73764
81196
88512
95752

Is there another location where the struct gets set that I need to clear up for the GC free the memory?

Happens in 3.2.2, 3.2.3, 3.3.0, 3.3-head, ruby-head.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0