From: "naruse (Yui NARUSE) via ruby-dev" <ruby-dev@...> Date: 2024-03-21T06:58:43+00:00 Subject: [ruby-dev:52081] [Ruby master Bug#20311] Struct.new("A") memory leak? Issue #20311 has been updated by naruse (Yui NARUSE). Backport changed from 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE ruby_3_3 f79b1d1ef1f7aa64d20f0eadbb3b0f8f7084deb3 merged revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a,f3af5ae7e6c1c096bbfe46d69de825a02b1696cf. ---------------------------------------- Bug #20311: Struct.new("A") memory leak? https://bugs.ruby-lang.org/issues/20311#change-107404 * Author: MaxLap (Maxime Lapointe) * Status: Closed * ruby -v: 3.3.0 * Backport: 3.0: WONTFIX, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE ---------------------------------------- The following code gives the impression of a memory leak. ```ruby 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. -- https://bugs.ruby-lang.org/