Use malloc instead of vectors