# Replace ArrayList.init/ensureTotalCapacity pairs with initCapacity · gitcafe/zig

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

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

Visibility: public

Requested revision: e97feb96e4daf7d53538c9c8773d50459a59e5ee

Requested commit: e97feb96e4daf7d53538c9c8773d50459a59e5ee

Commit: e97feb96e4daf7d53538c9c8773d50459a59e5ee

Tree: 33474da46590a20370d970d033a3123b620b2f81

Author: Ryan Liptak

Committer: Andrew Kelley

## Message

```
Replace ArrayList.init/ensureTotalCapacity pairs with initCapacity

Because ArrayList.initCapacity uses 'precise' capacity allocation, this should save memory on average, and definitely will save memory in cases where ArrayList is used where a regular allocated slice could have also be used.

```

## Parents

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

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