FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-112532: Isolate abandoned segments by interpreter by colesbury · Pull Request #113717 · python/cpython · GitHub

Repository navigation

gh-112532: Isolate abandoned segments by interpreter - #113717

Merged
DinoV merged 2 commits into
python:mainfrom
colesbury:gh-112532-abandoned-segments
Jan 4, 2024
Merged

DinoV merged 2 commits into
python:mainfrom
colesbury:gh-112532-abandoned-segments

Conversation

colesbury commented Jan 4, 2024 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Mimalloc segments are data structures that contain memory allocations along with metadata. Each segment is "owned" by a thread. When a thread exits, it abandons its segments to a global pool to be later reclaimed by other threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the --disable-gil builds. We want heaps to only store Python objects from a single interpreter. Absent this change, the abandoning and reclaiming process could break this isolation.

Mimalloc segments are data structures that contain memory allocations along
with metadata. Each segment is "owned" by a thread. When a thread exits,
it abandons its segments to a global pool to be later reclaimed by other
threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the
`--disable-gil` builds. We want heaps to only store Python objects from a
single interpreter. Absent this change, the abandoning and reclaiming process
could break this isolation.

DinoV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This probably doesn't matter for the actual Python usage because we use _mi_heap_init_ex, but do we need to initialize some value for tld_empty or set it in _mi_heap_init when we're off the main thread? I would think it just needs to be &_mi_abandoned_default to preserve the existing behavior.

Copy link
Copy Markdown
Contributor Author

@DinoV - yeah, that's right. I added the missing &_mi_abandoned_default to tld_empty.

DinoV enabled auto-merge (squash) January 4, 2024 21:59
DinoV merged commit fcb3c2a into python:main Jan 4, 2024
colesbury deleted the gh-112532-abandoned-segments branch January 4, 2024 22:22
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
…3717)

* pythongh-112532: Isolate abandoned segments by interpreter

Mimalloc segments are data structures that contain memory allocations along
with metadata. Each segment is "owned" by a thread. When a thread exits,
it abandons its segments to a global pool to be later reclaimed by other
threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the
`--disable-gil` builds. We want heaps to only store Python objects from a
single interpreter. Absent this change, the abandoning and reclaiming process
could break this isolation.

* Add missing '&_mi_abandoned_default' to 'tld_empty'
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…3717)

* pythongh-112532: Isolate abandoned segments by interpreter

Mimalloc segments are data structures that contain memory allocations along
with metadata. Each segment is "owned" by a thread. When a thread exits,
it abandons its segments to a global pool to be later reclaimed by other
threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the
`--disable-gil` builds. We want heaps to only store Python objects from a
single interpreter. Absent this change, the abandoning and reclaiming process
could break this isolation.

* Add missing '&_mi_abandoned_default' to 'tld_empty'
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…3717)

* pythongh-112532: Isolate abandoned segments by interpreter

Mimalloc segments are data structures that contain memory allocations along
with metadata. Each segment is "owned" by a thread. When a thread exits,
it abandons its segments to a global pool to be later reclaimed by other
threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the
`--disable-gil` builds. We want heaps to only store Python objects from a
single interpreter. Absent this change, the abandoning and reclaiming process
could break this isolation.

* Add missing '&_mi_abandoned_default' to 'tld_empty'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL