Opencv.js: Getting (index):413 Uncaught (in promise) abort("OOM"). Build with -s ASSERTIONS=1 for more info.
Hello,
I am getting this error from opencvjs and line number: 24 (we build the opencv.js as mentioned in Opencv document).
Could you please help to resolve this issue. Is there any way to catch this "OOM" and resume the execution smoother.
I used cv.calcOpticalFlowPyrLK(oldGray, frameGray, p0, p1, st, err, winSize, maxLevel, criteria); this code in my javascript, and handled this function insdie TRY and CATCH, but still getting OOM abort error as attached screenshot.
Below code runs well for 1 to 2 minutes and then start throwing OOM abort, so couldn't call any function inside opencvjs.
(For reference: https://github.com/opencv/opencv/issu... )
Try{
//some code written here, executes for few mins and then getting this OOM abort error
cv.calcOpticalFlowPyrLK(oldGray, frameGray, p0, p1, st, err, winSize, maxLevel, criteria);
}catch (err) {
console.log("Handle error===",err);
}
C:\fakepath\64662855-e1414c00-d417-11e9-9109-66b3f6b436c2.jpg
I had a similar problem, my code written in JS was running for 1-2 mins (time depended on the device) and then suddenly crashing. I was using findContours. And I couldn't find the exact reason for a while. Then I found that the reason is that I don't clean memory. OpenCV uses very large matrices and you need to manually delete them after they become useless. Look at this example
So the general advice is to delete variables and use pure functions. For more details please provide your code