Game Development Community

Memory assert error during unique and blended terrain creation

by Dennis Trevillyan · in Torque Game Engine Advanced · 02/10/2008 (8:32 am) · 1 replies

During creation of both unique and blender Atlas2 terrains TGEA fails an assert in platformMemory.cpp, line 1122. The error states that the memory was "not an allocated block". This seems to happen in versions 1.0.2 and 1.0.3. I tried a release version and it actually finished the terrain once without crashing. But only that one time - every other time it crashed as you might expect.

The following changes prevented the problem but do not address the root issue. At very least you can complete a terrain without crashing from a failed assert. In atlasResourceTOC.h comment out line 282:

virtual bool copyChunksToTOC(AtlasResourceTOC<StubType> *toc, S32 reformat = -1)
   {
      for(S32 i=0; i<getStubCount(); i++)
      {
         // Get our original stub, and issue the load.
         StubType *origArgs = getStub(i);
         immediateLoad(origArgs, EditorLoad);

         // Make a chunk copy and instate it.
         StubType *args = toc->getStub(i);
         AssertFatal(origArgs->hasResource(), "AtlasResourceTOC<T>::copyChunksToTOC - no chunk present in chunk copy.");

         toc->instateNewChunk(args, origArgs->mChunk->generateCopy(reformat), true);

         args->purge();
         //origArgs->purge();	[bold]<== comment this line to avoid memory error[/bold]
      }

      U32 len = mFile->getDeferredFile().lockStream(true)->getStreamSize();
      mFile->getDeferredFile().unlockStream();

      Con::printf("   - Copied %d chunks via copyChunksToTOC, stream len approx. %d bytes", getStubCount(), len);


      return true;
   }

I could not find anything on the forums for this error. Does anyone have further information on this?

- UPDATE -
Even though the final blender atlas terrain file was "successfully" it seems that it is not complete. The file will load (most of the time) although there are missing chunks which will cause TGEA to crash. Not surprising it seems.

#1
02/14/2008 (4:06 pm)
Is nobody else having problems generating Atlas terrains?