1

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时才会出现此泄漏

4

0 回答 0