---
title: "non-pointer-sync-pool-value"
description: "Detect sync.Pool values that allocate while being stored."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# non-pointer-sync-pool-value

**Default severity:** `warning`

`sync.Pool.Put` accepts an interface. Storing a concrete non-pointer value
requires boxing it on the heap, adding the allocation the pool is intended to
avoid. Slices are also boxed because the slice header itself is a value.

Store a pointer to the reusable value instead. Pointer-like maps, channels,
functions, interfaces, and unsafe pointers are accepted.

## Bad

```go
buffer := make([]byte, 0, 4096); pool.Put(buffer)
```

## Good

```go
buffer := make([]byte, 0, 4096); pool.Put(&buffer)
```

Source: https://strider.gempir.com/analyzers/non-pointer-sync-pool-value/index.mdx
