Fixed closure heap alloc optimization