# std.heap.WasmAllocator: redo · gitcafe/zig

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

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

Visibility: public

Requested revision: e2e60f5ff9942902e97aebfdf234bb6a0f821dfe

Requested commit: e2e60f5ff9942902e97aebfdf234bb6a0f821dfe

Commit: e2e60f5ff9942902e97aebfdf234bb6a0f821dfe

Tree: d2d9275197b00c6f998a60bda8e8a13b8d537127

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.heap.WasmAllocator: redo

The previous version had a fatal flaw: it did ensureCapacity(1) on the
freelist when allocating, but I neglected to consider that you could
free() twice in a row. Silly!

This strategy allocates an intrusive freelist node with every
allocation, big or small. It also does not have the problems with resize
because in this case we can push the upper areas of freed stuff into the
corresponding freelist.

```

## Parents

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

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