|
@ -42,7 +42,7 @@ func getSlotPool(size int) (*sync.Pool, bool) { |
|
|
func Allocate(size int) []byte { |
|
|
func Allocate(size int) []byte { |
|
|
if pool, found := getSlotPool(size); found { |
|
|
if pool, found := getSlotPool(size); found { |
|
|
slab := *pool.Get().(*[]byte) |
|
|
slab := *pool.Get().(*[]byte) |
|
|
for i := 0; i < size; i++ { |
|
|
|
|
|
|
|
|
for i, _ := range slab { |
|
|
slab[i] = 0 |
|
|
slab[i] = 0 |
|
|
} |
|
|
} |
|
|
return slab[:size] |
|
|
return slab[:size] |
|
|