Skip to content

Instantly share code, notes, and snippets.

@zsh-89
Created July 3, 2014 01:56
Show Gist options
  • Save zsh-89/fe3ffef66bad9d9862ba to your computer and use it in GitHub Desktop.
Save zsh-89/fe3ffef66bad9d9862ba to your computer and use it in GitHub Desktop.
How cv::imshow() breaks _CrtMemDifference()
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
_CrtMemState s1, s2, s3;
int main(void)
{
_CrtMemCheckpoint( &s1 );
{
cv::Mat xx(100, 100, CV_8UC3);
cv::imshow("win title", xx);
}
_CrtMemCheckpoint( &s2 );
if ( _CrtMemDifference( &s3, &s1, &s2) )
_CrtMemDumpStatistics( &s3 );
return 0;
}
@zsh-89
Copy link
Author

zsh-89 commented Jul 3, 2014

Output of _CrtMemDumpStatistics():

0 bytes in 0 Free Blocks.
110 bytes in 1 Normal Blocks.
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 30142 bytes.
Total allocations: 30142 bytes.

@zsh-89
Copy link
Author

zsh-89 commented Jul 3, 2014

cv::imread() can't break _CrtMemDifference().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment