mirror of
https://github.com/awnumar/memcall.git
synced 2026-02-06 17:59:56 +00:00
Cross-platform wrapper for memory-related system calls.
| .cirrus.yml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| memcall.go | ||
| memcall_freebsd.go | ||
| memcall_openbsd.go | ||
| memcall_osx.go | ||
| memcall_test.go | ||
| memcall_unix.go | ||
| memcall_windows.go | ||
| README.md | ||
memcall
This package provides a cross-platform wrapper allowing you to allocate memory outside of the garbage-collected Go heap.
Please report any issues that you experience.
Usage
// Allocate space for a key in a memory region locked into memory.
k, _ := memcall.Create(32, memcall.Readable, memcall.Writable, memcall.Locked)
// Get some random bytes
_ = k.Scramble()
// Use it
ciphertext := crypto.Encrypt(plaintext, k.Bytes())
// Get rid of it
_ = k.Destroy()
Todo:
- Realloc support.
- Improve tests.
- Allocate more efficiently.