move some heap buffers back to stack