On 10-10-30 8:58 PM, Sohail Somani wrote:
The second leak is a bit weirder and I'm not sure what is going on. I've
gone through the code and as far as I can tell, the transaction's
objects are deleted in the destructor. I've included the valgrind trace
as well.
Attached a partial patch. The problem seems that committed_ is set to
true even if the transaction fails (say due to a SQL failure). This
means that rollback() is not called in the destructor and the
transaction's objects are not deleted.
After fixing this, another leak remains. I've attached both the patch
and the modified test code with the valgrind trace.
Should have just used boost shared_ptr...
--
Sohail Somani
--
iBlog : http://uint32t.blogspot.com
iTweet: http://twitter.com/somanisoftware
iCode : http://bitbucket.org/cheez
diff -r 042b12c62486 vendor/Wt/Wt/Dbo/Transaction.C
--- a/vendor/Wt/Wt/Dbo/Transaction.C Sat Oct 30 15:53:13 2010 -0700
+++ b/vendor/Wt/Wt/Dbo/Transaction.C Sat Oct 30 19:12:31 2010 -0700
@@ -45,13 +45,13 @@
bool Transaction::commit()
{
if (isActive()) {
- committed_ = true;
if (impl_->transactionCount_ == 1) {
impl_->commit();
-
+ committed_ = true;
return true;
} else
+ committed_ = true;
return false;
} else
return false;
==28373== 36 (32 direct, 4 indirect) bytes in 1 blocks are definitely lost in
loss record 2 of 2
==28373== at 0x402569A: operator new(unsigned int) (vg_replace_malloc.c:255)
==28373== by 0x80A0F80: Wt::Dbo::ptr<Class>::ptr(Class*) (ptr_impl.h:169)
==28373== by 0x80A0B24: Wt::Dbo::ptr<Class>
Wt::Dbo::Session::add<Class>(Class*) (Session_impl.h:135)
==28373== by 0x809FF9B: TestWtFlushLeak::test_method()
(test_SchemaManager.cpp:109)
==28373== by 0x809FE82: TestWtFlushLeak_invoker() (test_SchemaManager.cpp:99)
==28373== by 0x8052084: boost::unit_test::ut_detail::unused
boost::unit_test::ut_detail::invoker<boost::unit_test::ut_detail::unused>::invoke<void
(*)()>(void (*&)()) (callback.hpp:56)
==28373== by 0x8052066:
boost::unit_test::ut_detail::callback0_impl_t<boost::unit_test::ut_detail::unused,
void (*)()>::invoke() (callback.hpp:89)
==28373== by 0x8193C8C:
boost::unit_test::callback0<boost::unit_test::ut_detail::unused>::operator()()
const (callback.hpp:118)
==28373== by 0x8193C2D: boost::unit_test::(anonymous
namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused>
>::operator()() (unit_test_monitor.ipp:41)
==28373== by 0x8193C10: int
boost::unit_test::ut_detail::invoker<int>::invoke<boost::unit_test::(anonymous
namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused>
> >(boost::unit_test::(anonymous
namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused>
>&) (callback.hpp:42)
==28373== by 0x8193BFC: boost::unit_test::ut_detail::callback0_impl_t<int,
boost::unit_test::(anonymous
namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused>
> >::invoke() (callback.hpp:89)
==28373== by 0x8052B0A: boost::unit_test::callback0<int>::operator()() const
(callback.hpp:118)
==28373==
==28373== LEAK SUMMARY:
==28373== definitely lost: 32 bytes in 1 blocks
==28373== indirectly lost: 4 bytes in 1 blocks
==28373== possibly lost: 0 bytes in 0 blocks
==28373== still reachable: 0 bytes in 0 blocks
==28373== suppressed: 0 bytes in 0 blocks
=
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest