Using the latest snapshot of SqPlus, I seem to be getting memory leaks when I use the overloadConstructor function when defining my class's.
I'm still researching into it, but at this stage, if I do not use the overloadConstructor then I do not see memory leaks. Using SquirrelVM to both initialize and shut down Squirrel, is there anything extra I have to do to ensure that overloadConstructor deallocates memory?
Inserting the Tuple3 code into my own source code also generates memory leaks, where as inserting my code into the test examples, no memory leaks occur.
struct NativeVector2
{
NativeVector2() : x(0.f), y(0.f) { };
NativeVector2(SQFloat in_x, SQFloat in_y) : x(in_x), y(in_y) { };
NativeVector2(SQInteger in_x, SQInteger in_y) : x(in_x), y(in_y) { };
virtual ~NativeVector2() { wxLogMessage(wxT("NativeVector2 released")); };
float x, y;
};
DECLARE_INSTANCE_TYPE_NAME(NativeVector2, Vector2);
Engine_Script::Engine_Script()
{
SquirrelVM::Init();
// Vector2 class
SqPlus::SQClassDef<NativeVector2>(wxT("Vector2"))
.overloadConstructor<NativeVector2(*)(void)>()
.overloadConstructor<NativeVector2(*)(float, float)>()
.overloadConstructor<NativeVector2(*)(int, int)>()
.overloadConstructor<NativeVector2(*)(NativeVector2&)>();
}
Running any scripts, which do ' local v = Vector2() ', will show that ~NativeVector2 is properly being deleted, yet when exiting the application I am leaking about 12 bytes of data.