From: Warren Young Date: August 3 2012 8:05pm Subject: Re: connection list problems List-Archive: http://lists.mysql.com/plusplus/9527 Message-Id: <501C2EF5.9050107@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 8/3/2012 12:58 PM, Bernd Prager wrote: > > void Dal::putConnection(boost::any connection) { > if((int)connectionPool.size() == connectionPoolMax) { > // pool is full > boost::lock_guard lock(mutex); > destroyConnection(connection); > } > connectionPool.push_back(connection); > } Explain to me how this doesn't insert destroyed connections into the pool when you hit the pool's size limit. Another likely problem is that this looks like it will create value copies of the Connection objects, which causes MySQL DB server re-connection. You'd do better here to use reference semantics.