Original Post
Hello, I have a little error in my code which I absolutely don't understand. Here is a snippet of the code that causes trouble: Patch::indicesLODStd and Patch::indicesLODMod are static members of type DWORD**. For simplicity lets assume LODCount is 3. So in line A and B I allocate 3 DWORD pointers. Then the loop is entered which will iterate 3 times. In every iteration I create a DWORD array and let the appropriate pointer of indicesLODStd and indicesLODMod point to it. The problem is: The programm crashes after the third iteration (when LOD=2) on line C with the message:
Patch::indicesLODStd = new DWORD*[LODCount]; /*A*/
Patch::indicesLODMod = new DWORD*[LODCount]; /*B*/
UINT LODQuadCount = cullingLODDesc.patchSize - 1;
UINT LODoffset;
for(UINT LOD = 0; LOD < LODCount; LOD++, LODQuadCount/=2) {
UINT indicesCountLOD = LODQuadCount * LODQuadCount * 6;
Patch::indicesLODStd[LOD] = new DWORD[indicesCountLOD]; /*C*/
Patch::indicesLODMod[LOD] = new DWORD[indicesCountLOD];
Patch::indexCountsLOD[LOD] = indicesCountLOD;
// some other stuff
}
Quote:I have no idea what causes this problem. How can the problem even crash just by calling new? Does anyone understand this problem (and know how to fix it)?
Windows has triggered a breakpoint in OutdoorRenderer.exe. This may be due to a corruption of the heap, and indicates a bug in OutdoorRenderer.exe or any of the DLLs it has loaded. The output window may have more diagnostic information