Giter Site home page Giter Site logo

go-mmap's Introduction

go-mmap

This package simplifies dealing with memory-mapped files by wrapping related system calls and constants and providing them here in one place. Currently this package provides rather complete support for Linux and OS X Darwin. Patches for other GOOS such as BSD and Windows are welcomed as long as you keep the API reasonably consistent.

Supported system calls include:

  • madvise
  • mincore
  • mlock
  • mmap
  • mprotect
  • msync
  • munlock
  • munmap
  • mlockall (Linux-only)
  • munlockall (Linux-only)

For the exact semantics of each system call and constant, please refer to the man pages on the corresponding platforms.

Documentation

API documentation is available at http://godoc.org/github.com/riobard/go-mmap

Limitations

Prior to Go 1.1, int is limited to 32-bit even on 64-bit platforms. As a result, a memory-mapped region []byte cannot be larger than 2GB since the length of a slice is determined by int. Since Go 1.1 int becomes 64-bit on 64-bit platforms, so []byte can be significantly larger. If you are using Go versions prior to Go 1.1, or if you are on 32-bit platforms, keep in mind the limitation.

Related

There are two other packages which might be useful to you if you are not satisfied by this one:

  • gommap (doc): this one is almost what I wanted, but lacks some flags and features on Linux and Darwin.
  • mmap-go (doc): this one lacks support for mprotect and mincore, but supports Windows.

go-mmap's People

Contributors

riobard avatar sentimentron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.