From bd66d056c8404915d21b5214e27ea1b2ffdd2892 Mon Sep 17 00:00:00 2001 From: typhoonzero Date: Fri, 8 Sep 2017 15:09:45 +0800 Subject: [PATCH] fix row buffer mem free --- paddle/math/RowBuffer.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paddle/math/RowBuffer.h b/paddle/math/RowBuffer.h index dbb829c4e..9ef5b8968 100644 --- a/paddle/math/RowBuffer.h +++ b/paddle/math/RowBuffer.h @@ -99,7 +99,11 @@ public: /** * @brief clear local buffer. It only affect auto-growth buffer. */ - inline void clear() { rowStore_.clear(); } + inline void clear() { + // swap an empty vector to it to free the memory. + std::vector> empty; + rowStore_.swap(empty); + } /** * @brief get current number of rows. -- GitLab