Commit fbc50692 authored by gaurides's avatar gaurides Committed by Scott Cyphers

Fix memory leak (#2409)

* Fix memory leak

* Add comments
parent 4731b6e8
......@@ -36,6 +36,10 @@ MKLDNNEmitter::~MKLDNNEmitter()
{
for (auto p : m_mkldnn_primitives)
delete p;
//To avoid memory leak in mkldnn, release any buffers that are not free'd yet.
//https://software.intel.com/en-us/mkl-linux-developer-guide-avoiding-memory-leaks-in-intel-mkl
//mkl_free_buffers() is not exposed at this point, hence using mkl_serv_free_buffers()
mkldnn_utils::mkl_serv_free_buffers();
}
const std::vector<mkldnn::primitive*>& MKLDNNEmitter::get_mkldnn_primitives() const
......
......@@ -34,6 +34,7 @@ namespace ngraph
namespace mkldnn_utils
{
extern mkldnn::engine global_cpu_engine;
extern "C" void mkl_serv_free_buffers();
mkldnn::memory::format
CreateNativeDataFormat(const ngraph::runtime::cpu::LayoutDescriptor& layout);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment