Ask Your Question
0

Opencv.js: Getting (index):413 Uncaught (in promise) abort("OOM"). Build with -s ASSERTIONS=1 for more info.

asked 2019-09-18 21:40:05 -0600

vasanthahr gravatar image

updated 2019-09-18 21:43:04 -0600

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

edit retag flag offensive close merge delete

Comments

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

const edged = new cv.Mat();
cv.Canny(dilated, edged, 60, 255);

dilated.delete();

So the general advice is to delete variables and use pure functions. For more details please provide your code

Lucy8 gravatar imageLucy8 ( 2019-09-23 09:00:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-09-27 22:20:16 -0600

vasanthahr gravatar image

Thanks, yes variable.delete() would help to solve this issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-09-18 21:40:05 -0600

Seen: 2,879 times

Last updated: Sep 18 '19