8000
Hi,
When i create a new caffe::Net object in a Thread the memory is not freed.
Below example without Thread works fine and frees memory:
int main() { for(int i=0;i<10;i++) { caffe::Net* cnn = new caffe::Net(("deploy.prototxt")); delete cnn; } std::cin.ignore(); return 0; }
The below example using Threads doesn't free memory
void threadWork() { caffe::Net* cnn = new caffe::Net(("deploy.prototxt")); delete cnn; } int main() { for(int i=0;i<10;i++) { std::thread t1(threadWork); t1.join(); } std::cin.ignore(); return 0; }
Do you know what is causing this?
memory pool manager is used for every thread, and these instances only freed when the program exit. check the code here and here
为什么在我的程序里面delete cnn就出错?
Activity
luoyetx commentedon Jun 29, 2018
memory pool manager is used for every thread, and these instances only freed when the program exit.
check the code here and here
Lin427 commentedon Oct 10, 2019
为什么在我的程序里面delete cnn就出错?