---
title: "Discussion on \"How to enforce zero allocations in Go when AllocsPerRun rounds them away\" | Hashnode"
description: "Discussion on \"How to enforce zero allocations in Go when AllocsPerRun rounds them away\". Originally published on ImportStatic.\nA test that asserts testing.AllocsPerRun(1000, f) == 0 passes for code that allocates, as long as it allocates in fewer than one call in a thousand, or only on th"
url: "https://hashnode.com/posts/how-to-enforce-zero-allocations-in-go-when-allocsperrun-rounds-them-away/6af27dd82b13f87abdc72e55"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to enforce zero allocations in Go when AllocsPerRun rounds them away](https://importstatic.hashnode.dev/how-to-enforce-zero-allocations-in-go-when-allocsperrun-rounds-them-away?utm_source=hashnode&utm_medium=feed)

Originally published on ImportStatic. A test that asserts testing.AllocsPerRun(1000, f) == 0 passes for code that allocates, as long as it allocates in fewer than one call in a thousand, or only on th

Nov 10 · 7 min read · importstatic.hashnode.dev  
Read the article

-   [#golang](https://hashnode.com/tag/golang)

## Written by

[ImportStatic](https://hashnode.com/@importstatic)

@importstatic

  
[View profile](https://hashnode.com/@importstatic)

Working notes on AI, Rust, Go and Databases, written for people who ship software and would rather read one tested example than three paragraphs of adjectives.

Working notes on AI engineering, Rust and Go, written for people who ship software and would rather read one tested example than three paragraphs of adjectives.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
