fixed connect pool leak memory

This commit is contained in:
fasiondog 2020-01-01 00:18:53 +08:00
parent 427ca6f741
commit df075948d2

View File

@ -40,7 +40,18 @@ public:
m_param(param),
m_closer(this) {}
virtual ~ConnectPool() = default;
/**
*
*/
virtual ~ConnectPool() {
while (!m_connectList.empty()) {
ConnectType *p = m_connectList.front();
m_connectList.pop();
if (p) {
delete p;
}
}
}
/** 连接实例指针类型 */
typedef std::shared_ptr<ConnectType> ConnectPtr;
@ -73,6 +84,7 @@ private:
if (0 == m_maxIdelSize || m_connectList.size() < m_maxIdelSize) {
m_connectList.push(p);
} else {
delete p;
m_count--;
}
} else {