List:MySQL++« Previous MessageNext Message »
From:Jonathan Wakely Date:December 22 2007 8:43pm
Subject:Re: problems in ConnectionPool
View as plain text  
On 22/12/2007, Jonathan Wakely <mysql@stripped> wrote:
>
> 2) When you remove a connection from the pool_ list it seems to be
> leaked.  My suggestion is to add a pure-virtual
> ConnectionPool::destroy() which the derived class must implement to
> free the connection.

If I'm right about this, ~ConnectionPool() should call destroy() on
each element of pool_.

Except that it can't, because the derived class destructor will
already have run and the pure virtual destroy() can't be called.

This means the derived destructor is required to destroy everything in
pool_, so this revised patch adds a clear_pool() member which derived
classes must call before the base ~ConnectionPool dtor runs.

This patch also uses STL algorithms to find old/unused connections in grab().

I'm now not sure about if or when last_used should be reset. The only
time you really know the connection is fresh is at creation.

Jon

Attachment: [text/x-patch] mysqlpp-cpool-2.patch
Thread
problems in ConnectionPoolJonathan Wakely22 Dec
  • Re: problems in ConnectionPoolJonathan Wakely22 Dec
    • Re: problems in ConnectionPoolJonathan Wakely22 Dec
  • Re: problems in ConnectionPoolWarren Young27 Dec
    • Re: problems in ConnectionPoolWarren Young27 Dec
      • Re: problems in ConnectionPoolJonathan Wakely27 Dec
        • Re: problems in ConnectionPoolWarren Young28 Dec
    • Re: problems in ConnectionPoolJonathan Wakely27 Dec
      • Re: problems in ConnectionPoolWarren Young3 Jan