github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/buf/pool.go (about)

     1  package buf
     2  
     3  func Get(size int) []byte {
     4  	if size == 0 {
     5  		return nil
     6  	}
     7  	return DefaultAllocator.Get(size)
     8  }
     9  
    10  func Put(buf []byte) error {
    11  	return DefaultAllocator.Put(buf)
    12  }
    13  
    14  // Deprecated: use array instead.
    15  func Make(size int) []byte {
    16  	return make([]byte, size)
    17  }