From: Warren Young Date: December 15 2004 12:35am Subject: Re: glibc detected double free or corruption List-Archive: http://lists.mysql.com/plusplus/3809 Message-Id: <41BF86C2.9050201@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Fabio.DAndria@stripped wrote: > Result CDatabase::ReturnQuery(string query) It would be more efficient to pass the string as a const reference. As it is, you are copying the string object when calling this function, which isn't necessary. > //executes a query and returns a resultset back > Query myQuery = myConn.query(); > myQuery.reset(); You only have to reset the query object when trying to reuse it. A newly-created query object is alredy reset. > //executes the query > Result myResult = myQuery.store(); > return myResult; Again, an unnecessary copy here. Just say "return myQuery.store();" > catch (BadQuery er) Another unnecessary copy. You can almost always catch exceptions by reference. As for the rest of your code, please reduce it to a simpler example. I'm not going to work my way through your threading code just to get to the MySQL++ issue underneath, if any.