Advertisement

as memory leaks?

Started by December 12, 2004 08:06 PM
7 comments, last by WitchLord 19 years, 11 months ago
I'm into the final stages of development on my project so I thought i'd run it through paul nettle's memory manager (www.fluidstudios.com) and it got very annoyed with angelscript (currently working with 1.10.1WIP1). I will resolve the memory leaks on my end, I just thought it was worth mentioning to whom it may concern. :)
Dan Royer, OwnerMarginally Clever Games
I'm not aware of any memory leaks in AngelScript. Would you mind helping me by pointing out in what situations you get memory leaks? Neither of my test frameworks report any memory leaks.

I can't access fluidstudios.com from here (it's barred by the company's proxy) so I can't check out Paul's memory manager. How does it work? Is it free?

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

Advertisement
It is free and you just plug it in somewhere convenient like as_config.h and recompile. it doesn't actually optimize memory allocation by partitioning of small sections from a few large allocations - rather it works a lot like boundschecker to veryify that every single byte allocated has been freed & can even tell you when you are allocating blocks bigger than is actually needed. The mmgr complains some 20 times if I

a=asCreateScriptEngine(ANGELSCRIPT_VERSION);
delete a;

and once or twice for every Register...() call.

You can also get it here: ftp://ftp.flipcode.com/code/mmgr.zip
Dan Royer, OwnerMarginally Clever Games
Interesting. Thanks for the alternative link. I'll download it and see what it says.

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

I plugged in Paul's memory manager in the library and gave it a run. I didn't find any memory leaks, but there are a few places where AngelScript apparently deletes memory that it never allocated. I'm currently tracking these down.

The first one I found was not in AngelScript but in MSVC++'s std::string's destructor.

Did you find any actual memory leaks in AngelScript?

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

Quote: Original post by Aggrav8d
The mmgr complains some 20 times if I

a=asCreateScriptEngine(ANGELSCRIPT_VERSION);
delete a;

and once or twice for every Register...() call.


I hope you're not actually calling delete on the script engine? You should be calling a->Release();

I don't get any complaints on the Register...() calls.

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

Advertisement
After removing the illegal delete in std::string, the memory manager no longer reports any problems with the AS library or the test framework.

AngelScript doesn't actually use std::string, so the problem actually not with the library itself.

Let me know if you still have trouble with AS.

Regards,
Andreas

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

Good to know. ...i'm embarassed to say that, yes, i was deleting it. I guess I didn't read the doccos closely enough. That was the source of the problems. Why isn't the destructor protected or private?
Dan Royer, OwnerMarginally Clever Games
Good question. I simply forgot about it. I'll add it to 2.0.0. I won't add it to 1.10.1 because it changes the interface.

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

This topic is closed to new replies.

Advertisement