diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2022-11-29 16:14:13 -0500 |
---|---|---|
committer | Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> | 2022-11-30 12:23:50 -0500 |
commit | a0b0365e905e1ac51998ace7e6fc723406a2f157 (patch) | |
tree | 5523f45099f3a5e2c8cf3112f4acc4cf42d5defe /tool/lib | |
parent | b30248f74a8f6ce37a78f07597c7c5452ff50abd (diff) | |
download | ruby-a0b0365e905e1ac51998ace7e6fc723406a2f157.tar.gz |
YJIT: Deallocate `struct Block` to plug memory leaks
Previously we essentially never freed block even after invalidation.
Their reference count never reached zero for a couple of reasons:
1. `Branch::block` formed a cycle with the block holding the branch
2. Strong count on a branch that has ever contained a stub never
reached 0 because we increment the `.clone()` call for
`BranchRef::into_raw()` didn't have a matching decrement.
It's not safe to immediately deallocate blocks during
invalidation since `branch_stub_hit()` can end up
running with a branch pointer from an invalidated branch.
To plug the leaks, we wait until code GC or global invalidation and
deallocate the blocks for iseqs that are definitely not running.
Diffstat (limited to 'tool/lib')
0 files changed, 0 insertions, 0 deletions