cv::resize function costs 143M GPU memory in opencv version 3.2.0
Below is my test script:
include <opencv2 core="" core.hpp="">
include <opencv2 imgproc="" imgproc.hpp="">
include <opencv2 highgui="" highgui.hpp="">
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
//#include
<opencv2 imgcodecs="" imgcodecs.hpp=""> include <iostream>
include <string>
<opencv2/imgcodecs/imgcodecs.hpp>
#include <iostream>
#include <string>
int main() {
std::string path = "/home/pangwong/TestSpace/test_images/car_test.png";
cv::Mat img = cv::imread(path);
for (int i = 0; i < 100000; i++) {
std::cin.get();
cv::resize(img, img, cv::Size(144, 144));
std::cout << "aaa" << std::endl;
std::cin.get();
}
}}
When the routine went to the first "std::cin.get()", no memory was occupied. But when I input something and went to the second "std::cin.get()", something strange happened. Bolow is the nvidia-smi result.
As we can see, 143M GPU memory has been occupied.
System Info:
- Ubuntu 16.04
- Opencv3.2.0, cmake compile flag WITH_CUDA=OFF
- Nvidia GTX1080Ti, CUDA8.0
Anybody could explain what happened and how can I release the memory consumption?
Thanks in advance.