So, I am passing video buffer(Float32Array buffer) to worker thread as a transferable object, it happens for each frame of the video(meaning, continuously video frames are being passed to worker). I did memory profiling, and worker thread is retaining the object, it seems garbage collector doesn't kick in. How to handle this case? I don't think one can invoke GC explicitly in JavaScript.
Here is the code snippet how I am passing video buffer to worker thread:
this.worker.postMessage({
command: 'SetVideoBuffer',
data: {
videoFrame: videoFrame
}
},
[videoFrame.buffer]);
Also, I tried setting the buffer at worker side to 'null', it didn't help.
Any idea how to resolve this, is this chrome thing? Please help.
Thank you!