1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-03 09:03:50 +00:00

lib/mmap: library to do memory allocation with anonymous memory maps

This commit is contained in:
Nick Craig-Wood
2018-05-22 14:47:30 +01:00
parent a43ed567ee
commit f0696dfe30
5 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// Fallback Alloc and Free for unsupported OSes
// +build plan9
package mmap
// Alloc allocates size bytes and returns a slice containing them. If
// the allocation fails it will return with an error. This is best
// used for allocations which are a multiple of the Pagesize.
func Alloc(size int) ([]byte, error) {
return make([]byte, size), nil
}
// Free frees buffers allocated by Alloc. Note it should be passed
// the same slice (not a derived slice) that Alloc returned. If the
// free fails it will return with an error.
func Free(mem []byte) error {
return nil
}