[ODE] Memory allocation

Andrzej Szombierski qq at kuku.eu.org
Sun Oct 3 11:53:46 MST 2004


On Sun, 3 Oct 2004, Dominic Jackson wrote:

> 
> OK, thanks for the quick reply, however ...
> 
> I looked at doing this but am not convinced that calling dGeomDestroy 
> is totally safe - surely the delete knows nothing about the inherited 
> structure (with its additional size). The memory alloc / free functions 
> we use involve knowing the size of object on delete, so maybe I do 

They involve knowing the size of the object, but thy know it themselves. A 
simple case:

int * a = new int[variable];
[...]
delete [] a;

In such case delete [] doesn't need to be told how large the array is, it 
knows it itself.

Anyway calling delete on dxGeom* will work just as on dxSphere* as long as 
dxSphere doesn't have its own (non-virtual) destructor.

-- 
:: Andrzej Szombierski :: qq at kuku.eu.org :: http://kuku.eu.org ::
:: anszom at bezkitu.com  :: radio bez kitu :: http://bezkitu.com ::



More information about the ODE mailing list