   Memory leak
  Hi there!! I have a problem with a memory leak that I don't know if it is a problem on how I register a class or is it an AngelScript problem. It only happens when I have an object from a registered C++ class. In this example, I have a Sprite class registered. Here is an example of the code I'm using:interface Actor {bool Initialize();void Unload();} class Pepe : Actor {Sprite spr;bool Initialize() {if (!spr.Load("data/graphics/uridium.spr"))return false;return true;}void Unload() {spr.Unload();}} Actor@[] pepe;const int COUNT = 1000;//==============================================// Actualizaciónbool Update(float dt) {if (KeyDown(KEY_1)) {pepe.resize(COUNT);for (int i=0; i < COUNT; i++) {Pepe caca;if (!caca.Initialize())return false;@pepe = @caca;}}if (KeyDown(KEY_2)) {for (int i=0; i < COUNT; i++) {pepe.Unload();@pepe = null;}while (GC(true) != 0);pepe.resize(0);}return true;}//==============================================So, when I press "1", the application memory usage increases by 3 mb but when I press "2" it doesn't decrease. Here's how I register the Sprite class:if (ScriptMgr::RegisterObjectType(_className, sizeof(Sprite), asOBJ_CLASS_CD) < 0)return false;if (ScriptMgr::RegisterObjectBehaviour(_className, asBEHAVE_CONSTRUCT,"void f()", asFUNCTION(Constructor), asCALL_CDECL_OBJLAST) < 0)return false;if (ScriptMgr::RegisterObjectBehaviour(_className, asBEHAVE_DESTRUCT,"void f()", asFUNCTION(Destructor), asCALL_CDECL_OBJLAST) < 0)return false;if (ScriptMgr::RegisterObjectBehaviour(_className, asBEHAVE_ADDREF,"void f()", asMETHOD(Sprite, AddRef), asCALL_THISCALL) < 0)return false;if (ScriptMgr::RegisterObjectBehaviour(_className, asBEHAVE_RELEASE,"void f()", asMETHOD(Sprite, Release), asCALL_THISCALL) < 0)return false;I don't know what's going on here. See you soon!   
  I've found a problem in my registration code, so for this example the problem is fixed. However, I'm still having trouble with a game i'm developing where this problem persist and I'm trying to isolate it to show you.;  I've solved the problem. It was my fault!I was registering AddRef and Release methods with asCALL_GENERIC instead of asCALL_THISCALL in other classes. So, the reference counter was filled by garbage.Sorry! ;);  I'm glad you found the problem. :)   