diff options
author | NAKAMURA Usaku <usa@ruby-lang.org> | 2021-11-24 19:37:50 +0900 |
---|---|---|
committer | NAKAMURA Usaku <usa@ruby-lang.org> | 2021-11-24 19:37:50 +0900 |
commit | 1d4e037a8011ac05b4ede8cdf8263515ba0e095e (patch) | |
tree | fa79657ff26d408f2cf495677e0c80decd487e29 /test/ruby | |
parent | 419266d44c54c6b75f1e824f060c8b388f7a405b (diff) |
merge revision(s) a4d5ee4f31bf3ff36c1a8c8fe3cda16aa1016b12: [Backport #18264]
[Bug #18264] Fix memory leak in TracePoint
TracePoint leaks memory because it allocates a `rb_tp_t` struct
without ever freeing it (it is created with `RUBY_TYPED_NEVER_FREE`).
---
test/ruby/test_settracefunc.rb | 10 ++++++++++
vm_trace.c | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index e16a4fc01e..0c41f247be 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -555,6 +555,16 @@ class TestSetTraceFunc < Test::Unit::TestCase } end + # Bug #18264 + def test_tracpoint_memory_leak + assert_no_memory_leak([], <<-PREP, <<-CODE, rss: true) +code = proc { TracePoint.new(:line) { } } +1_000.times(&code) +PREP +1_000_000.times(&code) +CODE + end + def trace_by_set_trace_func events = [] trace = nil |