Advertisement

"Free Heap block modified at after it was freed" in asCScriptEngine::Release

Started by March 23, 2012 04:18 PM
3 comments, last by vroad 12 years, 8 months ago
HEAP[hoge.exe]: HEAP: Free Heap block a69bf78 modified at a69bfb0 after it was freed

With AngelScript 2.23.0, my app shows this message before going asCScriptEngine's destructor.
This error is not shown with previous version(2.21.1).
How can I fix this problem? It's seems to difficult to post a program that produces same error.
Maybe it is an error in their new version, or maybe there is something in your code that was working but not it needs to change. You could get the source code of AngelScript, compile it and debug the execution of the script through it to check where that happens.
Advertisement
We might need more data, such as where the error is actually occurring. That error crops up when you write to a pointer after it has been freed.
Rantings, ravings, and occasional insight from your typical code-monkey: http://angryprogrammingprimate.blogspot.com/
There is obviously a problem with memory being modified after it was deallocated. This is usually caused by 'dangling pointers', and is something that reference counting attempts to prevent, as memory isn't deallocated while there are still references to it.

Whether this is a bug in AngelScript or your own application is impossible to say without further information.

Does the problem always happen, or is it intermittent? If it always happens, does it always happen at the same addresses? If it always happens at the same addresses you can set a memory break point at that address to catch the code that is actually making the invalid modification.

If the problem is intermittent or the addresses reported varies, then it will be much more difficult to catch. There are tools available that can help, both free and paid versions. Here's a couple of free tools I recommend trying:

- valgrind is an excellent tool for runtime checking memory management and would most likely be able to catch this problem. It's open source, but unfortunately I don't think it is readily available for Windows.
- cppcheck is an open source static code analyser that may be point the possible cause. This one is available for Windows.

A couple of comercial versions that I know of are Purify, Bullseye, and also Microsoft's analyze that comes with the professional version of MSVC. There might be trial versions available for these that you can try out, unless you have access to the real deal.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Using _CrtCheckMemory(),?I finally found a problem in source code of my application.
It accessed a property of object after deletion. It was not a problem in AngelScript.
Thank you for asking.

This topic is closed to new replies.

Advertisement