github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/mmap/mmap_unsupported.go (about)

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