Do Node-Addon-Api objects need deconstruction?

110 Views Asked by At

I'm using Node-Addon-Api to create addons in NodeJS. Every 30 second there is a call to the addon's function. Every time the function is called, 4 double arrays, with largest array size of 2400 values, are created.

I'm experiencing memory overload, so I was wondering it could be because on these 4 arrays.

Do I need to handle every object that has been created with the function New()? like Napi::Array::New or Napi::Number::New?

For example:

Napi::Array plotHistory_Napi_out = Napi::Array::New(env, 2400);

Do I need to release this memory? If so, how? Or does it happen automatically when the scope ends and Node.js's GC collects it?

0

There are 0 best solutions below