Skip to content
Permalink
Browse files

Merge pull request #140 from ONNC/feature/fix-target-backend-object-leak

Fix: TargetBackend object leak in onnc
  • Loading branch information...
a127a127 committed Mar 15, 2019
2 parents e61befd + 3582cba commit fce697b911e7ff78e819538c9463ad24724a586c
Showing with 8 additions and 2 deletions.
  1. +2 −0 lib/Target/NvDla/NvDlaMeta.cpp
  2. +6 −2 tools/onnc/ONNCApp.cpp
@@ -122,6 +122,8 @@ NvDlaBackendMeta::~NvDlaBackendMeta()
NVDLA_DBG("LUT release - %p\n", lut);
delete lut;
}

priv::LoadableFactory::deleteLoadable(m_Loadable.i());
}

#define UNIT_ALIGNMENT(x, unit) (((x) + ((unit)-1)) & ~((unit)-1))
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "ONNCApp.h"
#include <cstdlib>

#include <onnc/Target/TargetSelect.h>
#include <onnc/Target/TargetRegistry.h>
#include <onnc/Target/TargetBackend.h>
@@ -17,6 +17,10 @@
#include <onnc/Core/PassManager.h>
#include <onnc/ADT/Color.h>
#include <onnc/Support/IOStream.h>

#include <cstdlib>

#include <memory>
#include <string>

using namespace onnc;
@@ -57,7 +61,7 @@ int ONNCApp::compile()
}

PassManager pm;
TargetBackend* backend = target->createBackend(options().target());
const auto backend = std::unique_ptr<TargetBackend>(target->createBackend(options().target()));
backend->addTensorSel(pm);
backend->addTensorSched(pm);
backend->addMemAlloc(pm);

0 comments on commit fce697b

Please sign in to comment.
You can’t perform that action at this time.