You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a few bugs with refleak tracking in the free-threaded build uncovered in #114824:
We should account for blocks in abandoned segments
We should stop-the-world before traversing mimalloc heaps in case there are still other threads running
The mimalloc heap and segment traversal must call _mi_page_free_collect(page, true); to properly account for blocks that were deferred freed by other threads. We need to call this earlier than we currently do (before computing page stats).
_Py_DecRefSharedDebug was missing a _Py_IncRefTotal
- We did not account for abandoned segments, which could miss blocks in
multithreaded runs.
- The mimalloc heap traversal needed to call "_mi_page_free_collect"
earlier in order to get an accurate count of blocks in use.
- `_Py_DecRefSharedDebug` was missing a `_Py_IncRefTotal`, but this was
mostly offset by a missing accounting in `_Py_ExplicitMergeRefcount`.
- get_num_global_allocated_blocks should pause other threads to ensure
that traversing the mimalloc heaps is safe.
Fixes a few issues related to refleak tracking in the free-threaded build:
- Count blocks in abandoned segments
- Call `_mi_page_free_collect` earlier during heap traversal in order to get an accurate count of blocks in use.
- Add missing refcount tracking in `_Py_DecRefSharedDebug` and `_Py_ExplicitMergeRefcount`.
- Pause threads in `get_num_global_allocated_blocks` to ensure that traversing the mimalloc heaps is safe.
…ython#115188)
Fixes a few issues related to refleak tracking in the free-threaded build:
- Count blocks in abandoned segments
- Call `_mi_page_free_collect` earlier during heap traversal in order to get an accurate count of blocks in use.
- Add missing refcount tracking in `_Py_DecRefSharedDebug` and `_Py_ExplicitMergeRefcount`.
- Pause threads in `get_num_global_allocated_blocks` to ensure that traversing the mimalloc heaps is safe.
Bug report
There are a few bugs with refleak tracking in the free-threaded build uncovered in #114824:
_mi_page_free_collect(page, true);
to properly account for blocks that were deferred freed by other threads. We need to call this earlier than we currently do (before computing page stats)._Py_DecRefSharedDebug
was missing a_Py_IncRefTotal
Linked PRs
The text was updated successfully, but these errors were encountered: