Probably the same as: How to benchmark in-place functions? - #7 by rdeits (reallocation only happens sometimes, so you will rarely capture it from a single push!
call).
As for why you ran out of memory, I’m not sure–the updated code should use less memory than the original. I would recommend checking carefully that the new and old code actually do the same thing.