mmap_unsupported.go 587 B

1234567891011121314151617181920
  1. // Fallback Alloc and Free for unsupported OSes
  2. //go:build plan9 || js
  3. package mmap
  4. // Alloc allocates size bytes and returns a slice containing them. If
  5. // the allocation fails it will return with an error. This is best
  6. // used for allocations which are a multiple of the Pagesize.
  7. func Alloc(size int) ([]byte, error) {
  8. return make([]byte, size), nil
  9. }
  10. // Free frees buffers allocated by Alloc. Note it should be passed
  11. // the same slice (not a derived slice) that Alloc returned. If the
  12. // free fails it will return with an error.
  13. func Free(mem []byte) error {
  14. return nil
  15. }