2011/11/03
OpenCV 2.x Memory Leak 문제
2.2버전을 사용할 때에도 메모리 누수 문제가 발생하였는데 2.3.1버전에서도 여전히 문제가 발생하였다.
메모리 누수 로그 더보기
The thread 'Win32 Thread' (0xce0) has exited with code 2 (0x2).
Detected memory leaks!
Dumping objects ->
{251} normal block at 0x020DF158, 47 bytes long.
Data: <JPEG-2000 Code S> 4A 50 45 47 2D 32 30 30 30 20 43 6F 64 65 20 53
{250} normal block at 0x020D8570, 4 bytes long.
Data: <jpc > 6A 70 63 00
{249} normal block at 0x020D8700, 4 bytes long.
Data: <jpc > 6A 70 63 00
{248} normal block at 0x020D97D8, 51 bytes long.
Data: <JPEG-2000 JP2 Fi> 4A 50 45 47 2D 32 30 30 30 20 4A 50 32 20 46 69
{247} normal block at 0x020D8278, 4 bytes long.
Data: <jp2 > 6A 70 32 00
{246} normal block at 0x020D8400, 4 bytes long.
Data: <jp2 > 6A 70 32 00
{245} normal block at 0x020DF0E0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{244} normal block at 0x020DED28, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{243} normal block at 0x020DECB0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{242} normal block at 0x020DE8F8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{241} normal block at 0x020DE880, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{240} normal block at 0x020DE4C8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{239} normal block at 0x020DE450, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{238} normal block at 0x020DE098, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{237} normal block at 0x020DE020, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{236} normal block at 0x020DDC68, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{235} normal block at 0x020DDBF0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{234} normal block at 0x020DD838, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{233} normal block at 0x020DD7C0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{232} normal block at 0x020DD408, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{231} normal block at 0x020DD390, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{230} normal block at 0x020DCFD8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{229} normal block at 0x020DCF60, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{228} normal block at 0x020DCBA8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{227} normal block at 0x020DCB30, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{226} normal block at 0x020DC778, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{225} normal block at 0x020DC700, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{224} normal block at 0x020DC348, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{223} normal block at 0x020DC2D0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{222} normal block at 0x020DBF18, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{221} normal block at 0x020DBEA0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{220} normal block at 0x020DBAE8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{219} normal block at 0x020DBA70, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{218} normal block at 0x020DB6B8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{217} normal block at 0x020DB640, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{216} normal block at 0x020DB288, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{215} normal block at 0x020DB210, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{214} normal block at 0x020DAE58, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{213} normal block at 0x020DADE0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{212} normal block at 0x020DAA28, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{211} normal block at 0x020DA9B0, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{210} normal block at 0x020DA5F8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{209} normal block at 0x020DA580, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{208} normal block at 0x020DA1C8, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{207} normal block at 0x020DA150, 56 bytes long.
Data: <L } > 4C A3 7D 00 00 00 00 00 00 00 00 00 CD CD CD CD
{206} normal block at 0x020D9D98, 892 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{205} normal block at 0x020D9D10, 72 bytes long.
Data: < > C0 82 0D 02 B0 83 0D 02 C0 85 0D 02 B0 86 0D 02
{204} normal block at 0x020D9CB8, 24 bytes long.
Data: < > CD CD CD CD B8 9C 0D 02 01 00 00 00 CD CD CD CD
{203} normal block at 0x020D9688, 32 bytes long.
Data: <JPEG-2000 files > 4A 50 45 47 2D 32 30 30 30 20 66 69 6C 65 73 20
{202} normal block at 0x020D9C30, 76 bytes long.
Data: < } > 18 AE 7D 00 00 00 00 00 CD CD CD CD 88 96 0D 02
{201} normal block at 0x020D9BA8, 72 bytes long.
Data: < } 0 H > 20 7D 0D 02 30 82 0D 02 48 84 0D 02 20 85 0D 02
{200} normal block at 0x020D9B50, 24 bytes long.
Data: < P > CD CD CD CD CD CD CD CD CD CD CD CD 50 9B 0D 02
{199} normal block at 0x020D9A80, 148 bytes long.
Data: < } > BC AD 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{198} normal block at 0x020D9A28, 24 bytes long.
Data: < ( > CD CD CD CD 28 9A 0D 02 01 00 00 00 CD CD CD CD
{197} normal block at 0x020D99B8, 48 bytes long.
Data: <Portable Network> 50 6F 72 74 61 62 6C 65 20 4E 65 74 77 6F 72 6B
{196} normal block at 0x020D9930, 76 bytes long.
Data: < } > CC AF 7D 00 00 00 00 00 CD CD CD CD B8 99 0D 02
{195} normal block at 0x020D9558, 24 bytes long.
Data: < X > CD CD CD CD 58 95 0D 02 01 00 00 00 CD CD CD CD
{194} normal block at 0x020D9848, 168 bytes long.
Data: <t } > 74 AF 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{192} normal block at 0x020D9780, 24 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD 80 97 0D 02
{191} normal block at 0x020D93F0, 32 bytes long.
Data: <TIFF Files (*.ti> 54 49 46 46 20 46 69 6C 65 73 20 28 2A 2E 74 69
{190} normal block at 0x020D96F8, 76 bytes long.
Data: << } > 3C B5 7D 00 00 00 00 00 CD CD CD CD F0 93 0D 02
{188} normal block at 0x020D8E40, 24 bytes long.
Data: < @ > CD CD CD CD CD CD CD CD CD CD CD CD 40 8E 0D 02
{187} normal block at 0x020D95B8, 144 bytes long.
Data: < } > 0C B5 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{185} normal block at 0x020D8CA8, 24 bytes long.
Data: < > CD CD CD CD A8 8C 0D 02 01 00 00 00 CD CD CD CD
{184} normal block at 0x020D94D8, 64 bytes long.
Data: <Portable image f> 50 6F 72 74 61 62 6C 65 20 69 6D 61 67 65 20 66
{183} normal block at 0x020D9450, 76 bytes long.
Data: <P } > 50 B1 7D 00 00 00 00 00 CD CD CD CD D8 94 0D 02
{181} normal block at 0x020D9398, 24 bytes long.
Data: < > CD CD CD CD 98 93 0D 02 01 00 00 00 CD CD CD CD
{180} normal block at 0x020D8E98, 1216 bytes long.
Data: < } > 20 B1 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{178} normal block at 0x020D8DE8, 24 bytes long.
Data: < > CD CD CD CD E8 8D 0D 02 01 00 00 00 CD CD CD CD
{177} normal block at 0x020D8D88, 32 bytes long.
Data: <Sun raster files> 53 75 6E 20 72 61 73 74 65 72 20 66 69 6C 65 73
{176} normal block at 0x020D8D00, 76 bytes long.
Data: < } > A0 B4 7D 00 00 00 00 00 CD CD CD CD 88 8D 0D 02
{174} normal block at 0x020D8C50, 24 bytes long.
Data: < P > CD CD CD CD CD CD CD CD CD CD CD CD 50 8C 0D 02
{173} normal block at 0x020D8750, 1220 bytes long.
Data: <p } > 70 B4 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{171} normal block at 0x020D86A8, 24 bytes long.
Data: < > CD CD CD CD A8 86 0D 02 01 00 00 00 CD CD CD CD
{170} normal block at 0x020D8648, 32 bytes long.
Data: <JPEG files (*.jp> 4A 50 45 47 20 66 69 6C 65 73 20 28 2A 2E 6A 70
{169} normal block at 0x020D85C0, 76 bytes long.
Data: < } H > 0C AC 7D 00 00 00 00 00 CD CD CD CD 48 86 0D 02
{167} normal block at 0x020D8518, 24 bytes long.
Data: < > CD CD CD CD 18 85 0D 02 01 00 00 00 CD CD CD CD
{166} normal block at 0x020D8448, 148 bytes long.
Data: < } > DC AB 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{164} normal block at 0x020D83A8, 24 bytes long.
Data: < > CD CD CD CD A8 83 0D 02 01 00 00 00 CD CD CD CD
{163} normal block at 0x020D8348, 32 bytes long.
Data: <Windows bitmap (> 57 69 6E 64 6F 77 73 20 62 69 74 6D 61 70 20 28
{162} normal block at 0x020D82C0, 76 bytes long.
Data: < } H > 80 AB 7D 00 00 00 00 00 CD CD CD CD 48 83 0D 02
{160} normal block at 0x020D8220, 24 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD 20 82 0D 02
{159} normal block at 0x020D7D20, 1216 bytes long.
Data: <P } > 50 AB 7D 00 00 00 00 00 00 00 00 00 FF FF FF FF
{157} normal block at 0x020D7C00, 29 bytes long.
Data: < | | > 00 00 00 00 10 7C 0D 02 17 7C 0D 02 00 00 00 00
{156} normal block at 0x020D7B88, 57 bytes long.
Data: < ( { > 00 00 00 00 28 00 00 00 00 00 00 00 10 7B 0D 02
{155} normal block at 0x020D7B10, 54 bytes long.
Data: < ( { z > 00 00 00 00 28 00 00 00 88 7B 0D 02 98 7A 0D 02
{154} normal block at 0x020D7A98, 53 bytes long.
Data: < ( { z > 00 00 00 00 28 00 00 00 10 7B 0D 02 18 7A 0D 02
{153} normal block at 0x020D7A18, 61 bytes long.
Data: < ( z y > 00 00 00 00 28 00 00 00 98 7A 0D 02 A0 79 0D 02
{152} normal block at 0x020D79A0, 53 bytes long.
Data: < ( z y > 00 00 00 00 28 00 00 00 18 7A 0D 02 20 79 0D 02
{151} normal block at 0x020D7920, 61 bytes long.
Data: < ( y x > 00 00 00 00 28 00 00 00 A0 79 0D 02 A8 78 0D 02
{150} normal block at 0x020D78A8, 56 bytes long.
Data: < ( y > 00 00 00 00 28 00 00 00 20 79 0D 02 00 00 00 00
{144} client block at 0x020D6610, subtype c0, 64 bytes long.
a CDynLinkLibrary object at $020D6610, 64 bytes long
a CDynLinkLibrary object at $020D6610, 64 bytes long
Object dump complete.
원인은 MFC 라이브러리가 로드 되기전에 OpenCV core 라이브러리가 로드되어서 발생하는 문제로 OpenCV의 core 프로젝트 설정에서 use MFC 를 Shared DLL로 설정하고 System.cpp 파일에 아래 내용을 추가해 주면 해결 된다고 한다.(http://tech.groups.yahoo.com/group/OpenCV/message/78198)
#ifdef _DEBUG
// required for including afh.h
#undef _WINDOWS_
#include <afx.h>
// Force linking to MFC.
static BOOL unused = afxTraceEnabled;
#endif
하지만 2.3.1 버전에서는 통하지 않는 것으로 보인다.
이 문제는 프로젝트의 MFC 사용 설정을 Static 으로 설정하면 되지만 기존의 프로젝트가 Static으로 설정할 수 없는 경우는 소용이 없다.
현재로서는 Release 용 lib와 dll을 사용하거나 무시하는 방법 밖에 없어 보인다. 실제 배포하는 파일을 이용해도 동일한 현상이 발생하는데 왜 수정되지 않는지
Original Post : http://neodreamer-dev.tistory.com/612
No comments :
Post a Comment