#6 setTerrainMesh() related memory crash

open
nobody
None
5
2008-07-28
2008-07-28
P. Lagace
No

While trying to use setTerrainMesh(), had a memory corruption crash.

The cause: my neSimulatorSizeInfo.terrainNodesStartCount was initialized to zero.
... and then, the neTriangleTree.nodes initial allocation size was zero, and the "Alloc" method in the neArray was unable to make it grow, since the Reserve size was zero.

( data = (T*)alloc->Alloc(sizeof(T) * (size * 2)); )

my suggestions:
- better documentation, on the terrainNodesStartCount issue
- when in debug mode, an ASSERT in case of a bad terrainNodesStartCount.

Discussion

  • P. Lagace
    P. Lagace
    2008-07-28

    • summary: misleading assert() and memory crash --> setTerrainMesh() related memory crash