Memory corruption warning

Blitz3D Forums/Blitz3D Programming/Memory corruption warning

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Just a heads up to my fellow Blitzers. Clearing a surface after freeing the mesh it belongs to silently corrupts memory until your app dies in some random fashion.

I just spent 2 days trying to figure out why my new rendering code was dying in random places and for seemingly no good reason.

The problem was that I had...

FreeEntity( MyMesh )
ClearSurface( MySurf )

...and what I needed to have was...

ClearSurface( MySurf )
FreeEntity( MyMesh )

Seems obvious, but Blitz gives -no- kind of runtime error or warning about doing this. Memory is silently corrupted behind the scenes and the app will eventually die.

So be aware.