# Std.testing.allocator causes my tests to hang

**URL:** <https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202>\
**Category:** Help\
**Tags:** memory-management, testing, zig-0-17\
**Created:** [November 4, 2026, 12:49am UTC](https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202 "2026-11-04T00:49:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![olibombardier](https://ziggit.dev/user_avatar/ziggit.dev/olibombardier/32/10524_2.png) [@olibombardier](https://ziggit.dev/u/olibombardier)\
**Post date:** [November 4, 2026, 12:49am UTC](https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202/1 "2026-11-04T00:49:04Z")

</div>

Hi!

I don’t know if I’m missing something or if I found a regression in zig 0.17. I have a project where everything worked on zig 0.16, but after upgrading the project to 0.17, my tests hangs, never finishing or even crashing. I found that making a DebugAllocator that I instantiate myself solves the problem before realizing that it’s not the same type.

I thought it may be an issue in my code but it happens in std.json.parseFromSlice and other seemingly random places where I use the allocator. I don’t know how to begin debugging that further…

I don’t know if it help but here is the first spot where is hangs, it’s also the first usage of the allocator:

```zig
test "interpolation.json" {
    try run_tests_file("tests/specs/interpolation.json", false);
}

fn run_tests_file(comptime filename: []const u8, verbose: bool) !void {
    // The commented lines prevent the issue
    //var debug: std.heap.DebugAllocator(.{}) = .init;
    //const allocator = debug.allocator();
    const parsed = try std.json.parseFromSlice(
        test_tools.Spec,
        testing.allocator,
        //allocator,
        @embedFile(filename),
        .{
            .allocate = .alloc_always,
            .ignore_unknown_fields = true,
        });
    defer parsed.deinit();
    const spec = parsed.value;
    // etc...

```

---

<div class="post-metadata">

**Author:** ![olibombardier](https://ziggit.dev/user_avatar/ziggit.dev/olibombardier/32/10524_2.png) [@olibombardier](https://ziggit.dev/u/olibombardier)\
**Post date:** [November 4, 2026, 1:15am UTC](https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202/2 "2026-11-04T01:15:06Z")

</div>

Right as I post this, 0.17.1 is released. I though this fix could have covered my issue [https://codeberg.org/ziglang/zig/issues/37310](https://codeberg.org/ziglang/zig/issues/37310) but I have the same problem. If anything it just confirm I should open an issue…

---

<div class="post-metadata">

**Author:** ![squeek502](https://ziggit.dev/user_avatar/ziggit.dev/squeek502/32/409_2.png) [@squeek502](https://ziggit.dev/u/squeek502)\
**Post date:** [November 4, 2026, 8:15am UTC](https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202/3 "2026-11-04T08:15:11Z")

</div>

A full, compilable reproduction is always helpful for situations like this.

---

<div class="post-metadata">

**Author:** ![olibombardier](https://ziggit.dev/user_avatar/ziggit.dev/olibombardier/32/10524_2.png) [@olibombardier](https://ziggit.dev/u/olibombardier)\
**Post date:** [November 4, 2026, 1:54pm UTC](https://ziggit.dev/t/std-testing-allocator-causes-my-tests-to-hang/18202/4 "2026-11-04T13:54:12Z")

</div>

I spent a lot of time trying to reproduce the issue but couldn’t. I went back to my original project and it turns out I only needed to clear ./zig-cache…

So yeah… zig 0.17.1 fixed the issue and I feel a bit dumb…
