Project

General

Profile

Actions

Bug #20194

closed

Memory leak with TracePoint on bmethod

Added by peterzhu2118 (Peter Zhu) 4 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:116336]

Description

GitHub PR: https://github.com/ruby/ruby/pull/9614

When disabling the TracePoint on bmethod, the hooks list is not freed.

For example:

obj = Object.new
obj.define_singleton_method(:foo) {}
bmethod = obj.method(:foo)
tp = TracePoint.new(:return) {}

10.times do
  100_000.times do
    tp.enable(target: bmethod) {}
  end

  puts `ps -o rss= -p #{$$}`
end

Before:

18208
22832
26528
29728
34000
37776
40864
44400
47680
51504

After:

16688
17168
17168
17248
17696
17760
17824
17824
17856
17920
Actions #1

Updated by peterzhu2118 (Peter Zhu) 4 months ago

  • Status changed from Open to Closed

Applied in changeset git|b14674b236445fb70f484603e678722760f678f4.


Memory leak with TracePoint on bmethod

[Bug #20194]

When disabling the TracePoint on bmethod, the hooks list is not freed.

For example:

obj = Object.new
obj.define_singleton_method(:foo) {}
bmethod = obj.method(:foo)
tp = TracePoint.new(:return) {}

10.times do
  100_000.times do
    tp.enable(target: bmethod) {}
  end

  puts `ps -o rss= -p #{$$}`
end

Before:

18208
22832
26528
29728
34000
37776
40864
44400
47680
51504

After:

16688
17168
17168
17248
17696
17760
17824
17824
17856
17920

Updated by naruse (Yui NARUSE) 2 months ago

  • Backport changed from 3.0: UNKNOWN, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.0: UNKNOWN, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE

ruby_3_3 23bfe6218a690bbde5143e26bc6fb243347fb4b3 merged revision(s) b14674b236445fb70f484603e678722760f678f4.

Updated by nagachika (Tomoyuki Chikanaga) about 2 months ago

  • Backport changed from 3.0: UNKNOWN, 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE to 3.0: UNKNOWN, 3.1: REQUIRED, 3.2: DONE, 3.3: DONE

ruby_3_2 1b5c74a2408d248f35cb811327dd51f49ee37c9e merged revision(s) b14674b236445fb70f484603e678722760f678f4.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0