Preserve caller-owned memory-mapped Raw preload files - #14213
Merged
Conversation
This was referenced Aug 25, 2026
bruAristimunha
force-pushed
the
pr/2-fif-mmap
branch
from
August 25, 2026 08:41
b32d0da to
9d81515
Compare
bruAristimunha
force-pushed
the
pr/2-fif-mmap
branch
2 times, most recently
from
August 25, 2026 08:59
a2af445 to
856cb23
Compare
Member
|
I'm going to kill CIs on this and other PRs that depend on previous ones... otherwise no other PRs will have runners to test. |
Contributor
Author
bruAristimunha
force-pushed
the
pr/2-fif-mmap
branch
from
August 25, 2026 11:19
856cb23 to
0825b8b
Compare
bruAristimunha
marked this pull request as ready for review
August 25, 2026 11:19
bruAristimunha
marked this pull request as draft
August 25, 2026 11:28
bruAristimunha
force-pushed
the
pr/2-fif-mmap
branch
5 times, most recently
from
August 25, 2026 11:56
3995d9a to
faa6a45
Compare
FIF raw segments are read as byte-offset views into a PID-keyed memory map of the file instead of open/seek/read per call; buffer entries are selected with searchsorted on the sorted bounds. gzip, file-like objects, and non-simple tag types keep the legacy path. The generic memory-map cache in _read_segments_file also serves the other binary readers.
bruAristimunha
force-pushed
the
pr/2-fif-mmap
branch
from
August 25, 2026 12:02
faa6a45 to
6cce421
Compare
bruAristimunha
commented
Aug 25, 2026
Member
|
I think this should already work in theory: But it maybe "just" needs to be fixed? Because this is not the right result... It should look more like this |
Contributor
Author
|
hey @larsoner, can you please check again? |
larsoner
marked this pull request as ready for review
August 26, 2026 12:57
larsoner
requested review from
agramfort,
drammock,
larsoner and
mscheltienne
as code owners
August 26, 2026 12:57
larsoner
enabled auto-merge (squash)
August 26, 2026 12:58
drammock
approved these changes
Aug 26, 2026
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue (if any)
None.
What does this implement/fix?
This fixes the ownership semantics of caller-named memory-mapped preload files.
MNE already supports storing decoded data in a memory-mapped file through
preload=<path>andraw.load_data(memmap=<path>). Because that path is supplied by the caller, the resulting file should remainunder caller ownership. Previously,
BaseRaw.__del__could unlink the backing file when theRawobject was garbage-collected.This PR removes that automatic unlinking and clarifies the existing contract:
Raw.close()and after theRawobject is destroyed.RawArrayfollow the same ownership rule.This keeps the existing preload concepts unified: passing a path means “decode into this caller-owned memory-mapped file.” It does not introduce source-file memory mapping, persistent file handles, cache
reuse, or a new preload mode.
Additional information
Tests cover:
preload=<path>;load_data(memmap=<path>);close()and garbage collection;RawArraymemory maps;Validation performed locally: