summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2019-05-30 10:28:32 -0700
committerXusong Wang <xusongw@google.com>2019-05-30 10:28:32 -0700
commita84dacee30f670decf8ff664f907fd2ba7ce0e42 (patch)
tree4f3fcabf4a13da4063674b97ed54fcc5e16877a2
parentc8747bb09bd63bf7d4e01bd4625de05cd83bb6f8 (diff)
downloadml-a84dacee30f670decf8ff664f907fd2ba7ce0e42.tar.gz
Fix memory leakage in ostrstream.
std::ostrstream has to invoke freeze(false) after a call to str() to prevent memory leak. Fixes: 133860120 Test: NeuralNetworksTest_static Change-Id: I3570a870c25e1f60cd932cd72bb56a04c56bf8c9
-rw-r--r--nn/runtime/ExecutionPlan.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/nn/runtime/ExecutionPlan.cpp b/nn/runtime/ExecutionPlan.cpp
index 573f8a562..1a55b2951 100644
--- a/nn/runtime/ExecutionPlan.cpp
+++ b/nn/runtime/ExecutionPlan.cpp
@@ -1522,11 +1522,13 @@ void PlanModelSlicer::initializeSlice(Slice<T_SlicedModel>* slice) {
std::ostrstream fromName;
fromName << "Slice: From " << ModelVersion<decltype(mHidlModel)>::name << std::ends;
graphDump(fromName.str(), mHidlModel);
+ fromName.freeze(false);
}
{
std::ostrstream toName;
toName << "Slice: To " << ModelVersion<decltype(slice->mHidlModel)>::name << std::ends;
graphDump(toName.str(), convertToV1_2(slice->mHidlModel));
+ toName.freeze(false);
}
}