Skip to content
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

Problems with memory mapped files #8

Open
Archie3d opened this issue Feb 20, 2022 · 1 comment
Open

Problems with memory mapped files #8

Archie3d opened this issue Feb 20, 2022 · 1 comment

Comments

@Archie3d
Copy link

Two problems:

  • in index.go the "github.com/tysontate/gommap" package does not exist and should be replaced with "github.com/tysonmote/gommap" (or alternatively - "github.com/edsrzf/mmap-go")
  • The unit test segment_test.go does not close the segment before re-opening it. This leaks the mmaped file handles (at least on Windows) which results in test failure when calling s.Remove() (unable to truncate a mmaped file). The segment must be closed (s.Close()) before calling s, err = newSegment(dir, 16, c) for the test to pass.
@ryanhoangt
Copy link

Another (potential) problem I found when testing index struct using gommap is that in Close method, before truncating the file to its actual size, we must issue an i.mmap.UnsafeUnmap() call; otherwise we could get a PathError: The requested operation cannot be performed on a file with a user-mapped section open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants