From bccddcc41837ed809b79a3189b0edfa0f448e479 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 16 Oct 2014 11:11:24 +0200 Subject: [PATCH] cyclic ref (memory leak) fixed when request are left on sendQueue --- src/remote/codec.cpp | 3 +++ src/remote/codec.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/remote/codec.cpp b/src/remote/codec.cpp index cffe3fe..67bb701 100644 --- a/src/remote/codec.cpp +++ b/src/remote/codec.cpp @@ -1138,6 +1138,9 @@ namespace epics { // clean resources internalClose(true); + // this is important to avoid cyclic refs (memory leak) + clearSendQueue(); + _sendQueue.wakeup(); // post close diff --git a/src/remote/codec.h b/src/remote/codec.h index 3c36f54..9bfa24f 100644 --- a/src/remote/codec.h +++ b/src/remote/codec.h @@ -168,6 +168,11 @@ namespace epics { } } + size_t size() { + epics::pvData::Lock lock(_queueMutex); + return _queue.size(); + } + private: std::deque _queue;