Last active
February 15, 2016 09:07
-
-
Save mshabunin/447787f63d2771f2ae06 to your computer and use it in GitHub Desktop.
OpenCV memory leak test (Mac OS X)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/imgcodecs/imgcodecs.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <mach/mach.h> | |
#include <iostream> | |
#include <ctime> | |
using namespace std; | |
int main() | |
{ | |
// cout << cv::getBuildInformation() << endl; | |
cv::Mat image(1, 1, CV_8U); | |
time_t start; | |
time(&start); | |
time_t cur = start; | |
while (true) | |
{ | |
cv::imshow("Pixel", image); | |
cv::waitKey(1); | |
time_t tmp; | |
time(&tmp); | |
if (tmp != cur) | |
{ | |
cur = tmp; | |
struct task_basic_info t_info; | |
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; | |
task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count); | |
cout << "Time: " << cur - start << " s, " | |
<< "Resident: " << t_info.resident_size / (1024 * 1024) << " Mib" | |
<< endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment