Valgrind显示TF_Session泄漏

时间:2019-03-24 13:22:01

标签: tensorflow valgrind c-api

Valgrind在libtensorflow.so中显示Leak_DefinitelyLost。 这是用于简单会话初始化的Valgrind消息:

- operator new(unsigned long) tensorflow::(anonymous   
   namespace)::PosixEnv::StartThread(tensorflow::ThreadOptions const&,  
   std::string const&, std::function<void ()>)
   tensorflow::thread::ThreadPool::ThreadPool(tensorflow::Env*, 
   tensorflow::ThreadOptions const&, std::string const&, int, bool)
   tensorflow::thread::ThreadPool::ThreadPool(tensorflow::Env*,    
   std::string const&, int)
   tensorflow::LocalDevice::EigenThreadPoolInfo::EigenThreadPoolInfo(tensor
   flow::SessionOptions const&)

   tensorflow::LocalDevice::LocalDevice(tensorflow::SessionOptions    
   const&, tensorflow::DeviceAttributes const&)   
   tensorflow::ThreadPoolDevice::ThreadPoolDevice(tensorflow::SessionOption
   s const&, std::string const&, 
   tensorflow::gtl::IntType<tensorflow::Bytes_tag_, long long>, 
   tensorflow::DeviceLocality const&, tensorflow::Allocator*)   
   tensorflow::ThreadPoolDeviceFactory::CreateDevices(tensorflow::SessionOptions
   const&, std::string const&, std::vector<tensorflow::Device*,
   std::allocator>*)
   tensorflow::DeviceFactory::AddDevices(tensorflow::SessionOptions
   const&, std::string const&, std::vector<tensorflow::Device*,
   std::allocator>*)
   tensorflow::DirectSessionFactory::NewSession(tensorflow::SessionOptions
   const&, tensorflow::Session**)
   tensorflow::NewSession(tensorflow::SessionOptions const&,
   tensorflow::Session**) TF_NewSession

代码导致此泄漏:

TF_Status* status = TF_NewStatus();
TF_Graph* graph = TF_NewGraph();
TF_SessionOptions* options = TF_NewSessionOptions();
TF_Session* sess = TF_NewSession(graph, options, status);
TF_DeleteSessionOptions(options);

TF_CloseSession(sess, status);
TF_DeleteSession(sess, status);


TF_DeleteGraph(graph); 
TF_DeleteStatus(status);

请帮助了解是否以及如何解决此问题。 另外,只有在我使用泄漏消失禁用opencv的情况下链接opencv时,此泄漏才会出现

0 个答案:

没有答案