mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to v1.25.0
update kubernetes to latest v1.25.0 release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
f47839d73d
commit
e3bf375035
14
vendor/k8s.io/apimachinery/pkg/runtime/allocator.go
generated
vendored
14
vendor/k8s.io/apimachinery/pkg/runtime/allocator.go
generated
vendored
@ -24,12 +24,14 @@ import (
|
||||
// by caching created but unused items for later reuse, relieving pressure on the garbage collector.
|
||||
//
|
||||
// Usage:
|
||||
// memoryAllocator := runtime.AllocatorPool.Get().(*runtime.Allocator)
|
||||
// defer runtime.AllocatorPool.Put(memoryAllocator)
|
||||
//
|
||||
// memoryAllocator := runtime.AllocatorPool.Get().(*runtime.Allocator)
|
||||
// defer runtime.AllocatorPool.Put(memoryAllocator)
|
||||
//
|
||||
// A note for future:
|
||||
// consider introducing multiple pools for storing buffers of different sizes
|
||||
// perhaps this could allow us to be more efficient.
|
||||
//
|
||||
// consider introducing multiple pools for storing buffers of different sizes
|
||||
// perhaps this could allow us to be more efficient.
|
||||
var AllocatorPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &Allocator{}
|
||||
@ -58,7 +60,7 @@ func (a *Allocator) Allocate(n uint64) []byte {
|
||||
}
|
||||
// grow the buffer
|
||||
size := uint64(2*cap(a.buf)) + n
|
||||
a.buf = make([]byte, size, size)
|
||||
a.buf = make([]byte, size)
|
||||
a.buf = a.buf[:n]
|
||||
return a.buf
|
||||
}
|
||||
@ -70,5 +72,5 @@ type SimpleAllocator struct{}
|
||||
var _ MemoryAllocator = &SimpleAllocator{}
|
||||
|
||||
func (sa *SimpleAllocator) Allocate(n uint64) []byte {
|
||||
return make([]byte, n, n)
|
||||
return make([]byte, n)
|
||||
}
|
||||
|
Reference in New Issue
Block a user