求助程序退出时opencv产生内存泄露

编程环境VS2019+opencv4.4.4, MFC工程。
在程序中只要定义了Mat类型变量,无论预先设没设定没空间,在Dubuggh都会产生许多的内存泄露。如下所示:

Dumping objects ->
{7321} normal block at 0x0000024FF6B39920, 8 bytes long.
Data: 68 F9 CB 84 FF 7F 00 00
{7181} normal block at 0x0000024FF6B3A190, 16 bytes long.
Data: 48 3B 31 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7180} normal block at 0x0000024FF6B39BA0, 16 bytes long.
Data: < ;1 > C0 3B 31 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7179} normal block at 0x0000024FF6B39790, 16 bytes long.
Data:

70 3B 31 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7178} normal block at 0x0000024FF6B39290, 16 bytes long.
Data: < ;1 > 98 3B 31 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7177} normal block at 0x0000024FF6B39CE0, 16 bytes long.
Data: 48 07 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7176} normal block at 0x0000024FF6B392E0, 16 bytes long.
Data: < * > C0 07 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7175} normal block at 0x0000024FF6B39420, 16 bytes long.
Data:

70 07 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7174} normal block at 0x0000024FF6B39600, 16 bytes long.
Data: < * > 98 07 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7173} normal block at 0x0000024FF6B3A230, 16 bytes long.
Data: < * > 88 06 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7172} normal block at 0x0000024FF6B39B50, 16 bytes long.
Data: < * > 00 07 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7171} normal block at 0x0000024FF6B3A320, 16 bytes long.
Data: < * > B0 06 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7170} normal block at 0x0000024FF6B39A10, 16 bytes long.
Data: < * > D8 06 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7169} normal block at 0x0000024FF6B39560, 16 bytes long.
Data: < * > C8 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7168} normal block at 0x0000024FF6B39C40, 16 bytes long.
Data: <@ * > 40 06 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7167} normal block at 0x0000024FF6B3A000, 16 bytes long.
Data: < * > F0 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7166} normal block at 0x0000024FF6B39B00, 16 bytes long.
Data: < * > 18 06 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7165} normal block at 0x0000024FF6B39F60, 16 bytes long.
Data: < * > 08 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7164} normal block at 0x0000024FF6B3A2D0, 16 bytes long.
Data: < * > 80 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7163} normal block at 0x0000024FF6B39DD0, 16 bytes long.
Data: 30 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7162} normal block at 0x0000024FF6B39AB0, 16 bytes long.
Data: 58 05 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7161} normal block at 0x0000024FF6B39D80, 16 bytes long.
Data: 48 04 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7160} normal block at 0x0000024FF6B39E70, 16 bytes long.
Data: < * > C0 04 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7159} normal block at 0x0000024FF6B395B0, 16 bytes long.
Data:

70 04 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7158} normal block at 0x0000024FF6B3A410, 16 bytes long.
Data: < * > 98 04 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7157} normal block at 0x0000024FF6B399C0, 16 bytes long.
Data: < * > 80 03 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7156} normal block at 0x0000024FF6B39240, 16 bytes long.
Data: < * > F8 03 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7155} normal block at 0x0000024FF6B396A0, 16 bytes long.
Data: < * > A8 03 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7154} normal block at 0x0000024FF6B39380, 16 bytes long.
Data: < * > D0 03 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7152} normal block at 0x0000024FF6B39C90, 16 bytes long.
Data: < * > A8 02 2A 86 FF 7F 00 00 00 00 00 00 00 00 00 00
{7151} normal block at 0x0000024FF6B3A780, 16 bytes long.
.....................
在程序退出前也都有用release释放。在网上查了许多放法,什么在静态库中使用 MFC ,或设为延迟加载opencv库,都不好用,哪 位大神有好的解决办法帮一下呗,谢谢。

c++

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问