can't release object with obj handle member
class C
{
C()
{print("C()!!!"); }
~C()
{ print("~C..."); }
C2@ c2;
}
class C2
{};
then in main():
C c();
it prints: C()!!!
the deconstruction is never called!
but when I define "c2" as "C2 c2" then it prints:C()!!! ~C...
So what should I do to release object with handle member?
As objects with members as handles can potentially form circular references the garbage collector keeps track of these instances.
So, you'll need to call engine->GarbageCollect() at an appropriate time to free this instance. The GC in AngelScript is not invoked automatically, as the game developer will in general want complete control over when it is supposed to run.
Regards,
Andreas
So, you'll need to call engine->GarbageCollect() at an appropriate time to free this instance. The GC in AngelScript is not invoked automatically, as the game developer will in general want complete control over when it is supposed to run.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement