Author: wyoung
Date: Sat Oct 7 00:21:11 2006
New Revision: 1321
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1321&view=rev
Log:
Fixed a memory leak in Visual C++ run time library: when initting a
Query object, it was causing a double initialization, which caused the
RTL to lose track of the first block of memory it allocated in each
instance. Research behind the fix by Alex Burton <[EMAIL PROTECTED]>
and Matt Dargavel <[EMAIL PROTECTED]>.
Modified:
trunk/lib/query.cpp
trunk/lib/query.h
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1321&r1=1320&r2=1321&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Sat Oct 7 00:21:11 2006
@@ -30,8 +30,28 @@
namespace mysqlpp {
+Query::Query(Connection* c, bool te) :
+#if defined(_MSC_VER)
+std::ostream(std::_Noinit), // prevents a double-init memory leak in RTL
+#else
+std::ostream(0),
+#endif
+OptionalExceptions(te),
+Lockable(false),
+def(this),
+conn_(c),
+success_(false)
+{
+ init(&sbuffer_);
+ success_ = true;
+}
+
Query::Query(const Query& q) :
-std::ostream(0),
+#if defined(_MSC_VER)
+std::ostream(std::_Noinit), // prevents a double-init memory leak in RTL
+#else
+std::ostream(0),
+#endif
OptionalExceptions(q.throw_exceptions()),
Lockable(q.locked()),
def(q.def),
Modified: trunk/lib/query.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1321&r1=1320&r2=1321&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Sat Oct 7 00:21:11 2006
@@ -122,17 +122,7 @@
///
/// \param c connection the finished query should be sent out on
/// \param te if true, throw exceptions on errors
- Query(Connection* c, bool te = true) :
- std::ostream(0),
- OptionalExceptions(te),
- Lockable(false),
- def(this),
- conn_(c),
- success_(false)
- {
- init(&sbuffer_);
- success_ = true;
- }
+ Query(Connection* c, bool te = true);
/// \brief Create a new query object as a copy of another.
///
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits