diff --git a/CHANGELOG.md b/CHANGELOG.md index e692857..728536a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- avoid flushing empty memory maps in `Section::freeze` to prevent macOS errors - derived zerocopy traits for `SectionHandle` to allow storing handles in `ByteArea` sections - added example demonstrating `ByteArea` with multiple typed sections, concurrent mutations, and freezing or persisting the area - added example combining Python bindings with winnow parsing diff --git a/INVENTORY.md b/INVENTORY.md index d786b60..9505ef5 100644 --- a/INVENTORY.md +++ b/INVENTORY.md @@ -5,6 +5,7 @@ ## Desired Functionality - Add Kani proofs for winnow view helpers. +- Add test covering freezing an empty section to guard against flush errors on macOS. ## Discovered Issues - None at the moment. diff --git a/src/area.rs b/src/area.rs index 9156e6e..236e87e 100644 --- a/src/area.rs +++ b/src/area.rs @@ -176,7 +176,9 @@ where /// Freeze the section and return immutable [`Bytes`]. pub fn freeze(self) -> io::Result { - self.mmap.flush()?; + if self.mmap.len() > 0 { + self.mmap.flush()?; + } let len_bytes = self.elems * core::mem::size_of::(); let offset = self.offset; // Convert the writable mapping into a read-only view instead of