mirror of
https://github.com/awnumar/memcall.git
synced 2026-02-07 02:09:47 +00:00
1,016 B
1,016 B
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.