If you don't want to create elements dynamically, consider to create a (big) buffer of MotionVector instances during startup and reuse those when needed. Then you will not get the penalty of creating/destructing them dynammically.
Of course you have to write some small functions to get a 'free' instance and to obtain one, use a boolean in the struct for that (or by using an interface).
To do this you could e.g.:
Create during initialisation of your app the motionvectors:
MotionVectors motionVectors;
Add a boolean to the MotionVector class:
public class MotionVector
{
bool InUse { get; set; }
public MotionVector()
{
InUse = false;
}
}
Define the new class MotionVectors:
class MotionVectors
{
MotionVector _instances[100];
public void Free(MotionVector vector)
{
var index = 'search vector in _instances'
_instances[index].Inuse = false;
}
public MotionVector GetNewInstance()
{
var index = 'first free vector in _instances'
_instances[index].Inuse = true;
return _instances[index];
}
}