Ask Your Question
0

How can I delete and free Mat from memory?

asked 2019-04-22 04:22:13 -0600

hua gravatar image
 Mat rowPaddedImage(src.size(), CV_64F, Scalar(0, 0, 0));
copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
edit retag flag offensive close merge delete

Comments

delete nothing. Mat is a shared ptr : don't worry about memory management

LBerger gravatar imageLBerger ( 2019-04-22 04:39:40 -0600 )edit

Thank you!

hua gravatar imagehua ( 2019-04-22 05:14:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-04-22 04:57:43 -0600

berak gravatar image

you NEVER use new or delete here.

Mat m(H,W,sometype);

will allocate data

m.release(); // called automatically at end of scope

will deallocate it

edit flag offensive delete link more

Comments

Thank you!

hua gravatar imagehua ( 2019-04-22 05:14:18 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-04-22 04:22:13 -0600

Seen: 2,380 times

Last updated: Apr 22 '19