Skip to content

Improving mmap_windows.go #162

Closed
@database64128

Description

@database64128

There are a few issues with the current mmap implementation for Windows.

  1. The file mapping handle can be closed right after calling MapViewOfFile. There's no need to keep it in a map.
  2. On 32-bit systems, with large files, MapViewOfFile may return a partial mapping. The VirtualQuery should be called on the returned address to determine the actual size of the mapping, and return an error if the mapping is incomplete. See https://github.com/golang/go/blob/master/src/cmd/go/internal/mmap/mmap_windows.go.
  3. The mapping is opened with read-only access. No need to call FlushViewOfFile at all.

I can open a PR to address these issues, if you are OK with it.

These changes would be essentially a rewrite of mmap_windows.go, so the special license can be removed as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions