Skip to content

Write-through support for memory-mapping #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 5, 2024
Merged

Write-through support for memory-mapping #81

merged 7 commits into from
Aug 5, 2024

Conversation

dranjan
Copy link
Owner

@dranjan dranjan commented Aug 5, 2024

Closes #79.
Resolves #80.


📚 Documentation preview 📚: https://python-plyfile--81.org.readthedocs.build/en/81/

chpatrick and others added 6 commits June 16, 2024 23:55
The input file wasn't even being memory-mapped!
Documentation and tests have also been added.
- Drop official support for Python 3.8.
- Drop official support for NumPy < 1.21.
@dranjan dranjan merged commit b1aa6df into master Aug 5, 2024
6 checks passed
>>> isinstance(plydata['vertex'].data, numpy.memmap)
True
>>> plydata['vertex']['x'] = 100
>>> plydata['vertex'].data.flush()
Copy link

@nh2 nh2 Mar 25, 2025

Choose a reason for hiding this comment

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

@dranjan: Thank you!

I should also share this info:

To make Linux release the memory of an mmaped plyfile so that RES ram usage goes down, I have to:

import mmap

# Once, after opening:
for element in plydata.elements:
  element.data._mmap.madvise(mmap.MADV_SEQUENTIAL)  # if we're doing sequential writes

# After writing enough:
plydata['vertex'].data.flush()
plydata['vertex'].data._mmap.madvise(mmap.MADV_DONTNEED)

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.

Support NumPy 2.0
3 participants