How to properly allocate space for a polyline, knowing how many points I allow at most?

Hi,
I have a struct which contains a ofPolyline as one of its members. I want to allocate enough space for the whole struct, because I keep getting exceptions when I add points to the polyline member of an instance of the struct. I know how many points I want to put at most in the polyline. How would you suggest proceeding?

Hi! ofPolyline has a resize method.