# std.heap.GeneralPurposeAllocator: fix slot_counts calculation · gitcafe/zig

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

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

Visibility: public

Requested revision: 86261915497fe6b9e0802b2d1e23b5f49c1d2757

Requested commit: 86261915497fe6b9e0802b2d1e23b5f49c1d2757

Commit: 86261915497fe6b9e0802b2d1e23b5f49c1d2757

Tree: 52b08560ef36070751c6cf9bc0cf1062c9d30da1

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.heap.GeneralPurposeAllocator: fix slot_counts calculation

In larger small buckets, the comptime logic that computed slot count did
not verify that the number it produced was valid. Now it verifies it,
which made this bug into a compile error. Then I fixed the bug by
introducing a "minimum slots per bucket" declaration.

```

## Parents

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

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