Commit charge (Private bytes) high with cudafilters
Hello,
I have issues with a very high Commit charge (as it is displayed in Windows by Resource Monitor) as soon as I start using CUDA filters in my application.
Here is a simple code to replicate the issue:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/cudafilters.hpp>
#include <iostream>
int main(int argc, char** argv)
{
std::cout << cv::getBuildInformation() << std::endl;
cv::Mat image = cv::Mat::ones(cv::Size(32, 32), CV_8UC1) * 128;
cv::Ptr<cv::cuda::Filter> pFilter;
//pFilter = cv::cuda::createBoxFilter(CV_8UC1, CV_8UC1, cv::Size(5, 5)); //(!!!)
cv::namedWindow("Input", cv::WINDOW_AUTOSIZE);
cv::imshow("Input", image);
cv::waitKey(0);
return 0;
}
With the line marked with (!!!) commented, the Commit is at 8136 KB. When I uncomment it, it jumps to 609952 KB.
I am using OpenCV 3.4.2 on Windows 10 64-bit, built with VS 2013 and CUDA v8.0 (more details about the build at the end of the message).
I've been struggling with this issue for several days, here's what I've been able to find out:
- Normally, the Commit size isn't so important, because the program will never actually use that insane amount. It's memory that's just reserved, but never used, so if other programs need resources, the unused but reserved memory pages can be transferred into the pagefile, where they will comfortably sit until my program ends.
- HOWEVER, if the sum of RAM + max page file size is insufficient, the program won't start! This is a problem with which I have to deal, as the software on which I'm working will have several instances of an exe running on different data at the same time, and I cannot change this.
- On a PC with insufficient RAM for all my exes but with more than enough Page file, all the instances of my program take a long time to start and to do the first image processing, because Windows is rearranging what pages it keeps in RAM and what in the Page File. Subsequent commands that call image processing routines are processed quickly, as there is never any need to re-transfer stuff back from the Page File (I always do more or less the same image processing operations).
- The issue is not so much related to opencv_world: whether you build OpenCV to get separate dlls or one big dll, I still get a large Commit size, although the amount is different.
Does anyone have any ideas as to how I can correct this issue? Am I doing something wrong, or is this a bug, or is this something unavoidable and I have to find a way to live with it? Any help will be much appreciated!
Note: my applications need to run on Maxwell and Pascal GPUs, no need for anything older.
Details about the build:
General configuration for OpenCV 3.4.2 =====================================
Version control: unknown
Platform:
Timestamp: 2018-07-16T12:39:40Z
Host: Windows 10.0.16299 AMD64
CMake: 3.7 ...