Ask Your Question

kalenko's profile - activity

2015-05-20 04:48:10 -0600 received badge  Taxonomist
2012-11-05 20:07:06 -0600 answered a question Why does this code snip produce memory leaks ?

@worst guy ever: Do you mean that the CRT debug reports are wrong ?

2012-11-05 00:48:27 -0600 answered a question Why does this code snip produce memory leaks ?

@worst guy ever: Do you mean that the CRT debug reports are wrong ?

2012-11-02 04:12:17 -0600 received badge  Editor (source)
2012-11-01 23:18:38 -0600 asked a question Why does this code snip produce memory leaks ?

Hi everybody,

I have a small program which uses Opencv library. And I do not know why it produce memory leaks. Here is the all program code:

#include <opencv2\opencv.hpp>
#include <opencv2\highgui\highgui.hpp>

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

#ifdef _DEBUG   
    #ifndef DBG_NEW      
        #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )      
        #define new DBG_NEW   
#endif
#endif  // _DEBUG
class C
{
public: 
        C();
        ~C();
        void Test();
};
void C::Test()
{
    IplImage * image = cvCreateImage(cvSize(640, 680), 8, 3);
    cvReleaseImage(&image);
    image = NULL;
}
int main(int argc, char** argv)
{
    _CrtDumpMemoryLeaks();
}


And here is the Output window:

'CVSample.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'CVSample.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
Detected memory leaks!
Dumping objects ->
{135} normal block at 0x00454B18, 29 bytes long.
 Data: <    (KE /KE     > 00 00 00 00 28 4B 45 00 2F 4B 45 00 00 00 00 00 
{134} normal block at 0x00454AA0, 57 bytes long.
 Data: <    (       (JE > 00 00 00 00 28 00 00 00 00 00 00 00 28 4A 45 00 
{133} normal block at 0x00454A28, 54 bytes long.
 Data: <    (    JE  IE > 00 00 00 00 28 00 00 00 A0 4A 45 00 B0 49 45 00 
{132} normal block at 0x004549B0, 53 bytes long.
 Data: <    (   (JE 0IE > 00 00 00 00 28 00 00 00 28 4A 45 00 30 49 45 00 
{131} normal block at 0x00454930, 61 bytes long.
 Data: <    (    IE  HE > 00 00 00 00 28 00 00 00 B0 49 45 00 B8 48 45 00 
{130} normal block at 0x004548B8, 53 bytes long.
 Data: <    (   0IE 8HE > 00 00 00 00 28 00 00 00 30 49 45 00 38 48 45 00 
{129} normal block at 0x00454838, 61 bytes long.
 Data: <    (    HE  GE > 00 00 00 00 28 00 00 00 B8 48 45 00 C0 47 45 00 
{128} normal block at 0x004547C0, 56 bytes long.
 Data: <    (   8HE     > 00 00 00 00 28 00 00 00 38 48 45 00 00 00 00 00 
Object dump complete.
The program '[2620] CVSample.exe: Native' has exited with code 0 (0x0).

I do not know why ? please help ?