# std.heap.SmpAllocator: rotate on free sometimes · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1754e014f5da09bf83a7ee1e53132325fd78d1c1)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1754e014f5da09bf83a7ee1e53132325fd78d1c1

Requested commit: 1754e014f5da09bf83a7ee1e53132325fd78d1c1

Commit: 1754e014f5da09bf83a7ee1e53132325fd78d1c1

Tree: 840242c06840a052c963349702df4a9566feb0f7

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.heap.SmpAllocator: rotate on free sometimes

* slab length reduced to 64K
* track freelist length with u8s
* on free(), rotate if freelist length exceeds max_freelist_len

Prevents memory leakage in the scenario where one thread only allocates
and another thread only frees.

```

## Parents

- [a9d30056167cbe54c0c144199f01a56f6cdcdafc](https://git.cafe/gitcafe/zig/commit/a9d30056167cbe54c0c144199f01a56f6cdcdafc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1754e014f5da09bf83a7ee1e53132325fd78d1c1?format=markdown)
