atproto relay implementation in zig zlay.waow.tech

revert mallinfo2 to mallinfo — zig's bundled glibc lacks mallinfo2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+8 -7
+8 -7
src/broadcaster.zig
··· 766 766 } 767 767 } else |_| {} 768 768 769 - // glibc malloc stats via mallinfo2 — uses size_t fields (no 2 GiB overflow), 770 - // reports across ALL thread arenas (mallinfo only reports the main arena) 771 - const mi = malloc_h.mallinfo2(); 772 - const arena: u64 = mi.arena; 773 - const in_use: u64 = mi.uordblks; 774 - const free_bytes: u64 = mi.fordblks; 775 - const mmap_bytes: u64 = mi.hblkhd; 769 + // glibc malloc stats — mallinfo fields are c_int, bitcast to u32 to extend range to 4 GiB. 770 + // note: mallinfo only reports the main arena, not per-thread arenas. 771 + // for accurate total heap picture, rely on RssAnon from /proc/self/status above. 772 + const mi = malloc_h.mallinfo(); 773 + const arena: u64 = @as(u32, @bitCast(mi.arena)); 774 + const in_use: u64 = @as(u32, @bitCast(mi.uordblks)); 775 + const free_bytes: u64 = @as(u32, @bitCast(mi.fordblks)); 776 + const mmap_bytes: u64 = @as(u32, @bitCast(mi.hblkhd)); 776 777 std.fmt.format(w, 777 778 \\# TYPE relay_malloc_arena_bytes gauge 778 779 \\relay_malloc_arena_bytes {d}