Heap size increases constantly when i tried to run the extract function in a new thread with the same instance of torch jit script module. I noticed that new heap allocated after the forward call. If commented out the forward call, no heap would be allocated. I am using CPU only with pytorch version 1.2.0. No extra heap allocated if running on single thread.
Am i doing something wrong?
A new thread is created with the code below

do{

std::thread th1(extract);
th1.join();
std::cin.get();


} while (true);


image.png1099×405 21.3 KB


image.png1229×457 44.2 KB