github.com/scottcagno/storage@v1.8.0/pkg/util/lowerlevellibs/bytealloc/rawalloc/rawalloc.go (about)

     1  package rawalloc
     2  
     3  // New returns a new byte slice of the specified length and capacity where the
     4  // backing memory is uninitialized. This differs from make([]byte) which
     5  // guarantees that the backing memory for the slice is initialized to zero. Use
     6  // carefully.
     7  func New(len, cap int) []byte {
     8  	ptr := mallocgc(uintptr(cap), nil, false)
     9  	return (*[maxArrayLen]byte)(ptr)[:len:cap]
    10  }