Welcome to the Julia forum.
PushVectors explicitly does what you’re requesting, but I believe that in general Julia does not deallocate the underlying memory if you pop!
off of or resize!
a vector. The only real advantage to PushVectors is that it avoids a call into the runtime library at each usage of push!
. There’s some discussion of the performance model of push!
and friends scattered about on this forum that might be helpful.