Added release function to attempt to explicitly free mat memory

This commit is contained in:
Max Ehrlich 2015-07-23 10:34:56 -04:00
parent 2ddb97047e
commit 1eeae7879c
2 changed files with 12 additions and 0 deletions

View File

@ -101,6 +101,7 @@ Matrix::Init(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(ctor, "setWithMask", SetWithMask); NODE_SET_PROTOTYPE_METHOD(ctor, "setWithMask", SetWithMask);
NODE_SET_PROTOTYPE_METHOD(ctor, "meanWithMask", MeanWithMask); NODE_SET_PROTOTYPE_METHOD(ctor, "meanWithMask", MeanWithMask);
NODE_SET_PROTOTYPE_METHOD(ctor, "shift", Shift); NODE_SET_PROTOTYPE_METHOD(ctor, "shift", Shift);
NODE_SET_PROTOTYPE_METHOD(ctor, "release", Dispose);
target->Set(NanNew("Matrix"), ctor->GetFunction()); target->Set(NanNew("Matrix"), ctor->GetFunction());
}; };
@ -2253,3 +2254,12 @@ NAN_METHOD(Matrix::Shift){
NanReturnUndefined(); NanReturnUndefined();
} }
NAN_METHOD(Matrix::Release)
{
SETUP_FUNCTION(Matrix)
mat.release();
NanReturnUndefined();
}

View File

@ -115,6 +115,8 @@ class Matrix: public node::ObjectWrap {
JSFUNC(SetWithMask) JSFUNC(SetWithMask)
JSFUNC(MeanWithMask) JSFUNC(MeanWithMask)
JSFUNC(Shift) JSFUNC(Shift)
JSFUNC(Release)
/* /*
static Handle<Value> Val(const Arguments& args); static Handle<Value> Val(const Arguments& args);
static Handle<Value> RowRange(const Arguments& args); static Handle<Value> RowRange(const Arguments& args);