Memory Leak Question

Forum for posting problems using QxOrm library

Memory Leak Question

Postby QtConstruct » Tue Mar 12, 2013 12:55 pm

Hallo QxOrm Specialists,
i work in my Software-Project with QxOrm.
In one Method i fill a DataStructure with Data from the Database:

Code: Select all
typedef boost::shared_ptr<MyObject> myobject_ptr;
typedef std::vector<myobject_ptr> type_lst_myobjects;

type_lst_myobjects mydatastructure;
mydatastructure.clear(); // std::vector
qx::QxSqlQuery query("");
QSqlError daoError = qx::dao::fetch_by_query(query, mydatastructure);


In the last line my Memory Leak Finder (Visual Leak Detector from codeplex Platform) says that there is a Memory Leak and i don't know why.
The last line is the last place on the stack trace which i wrote by myself. after that the stack goes Forward with qxorm and boost files.
Whats wrong? Where is my mistake?

d:\qxorm\inl\qxdatamember\qxdatamemberx.inl (164): myprogram.exe!qx::QxDataMemberX<MyObject>::relationManyToOne<boost::shared_ptr<AnotherObject>,MyObject> + 0x7 bytes
d:\qxorm\inl\qxdatamember\qxdatamemberx.inl (128): myprogram.exe!qx::QxDataMemberX<MyObject>::relationManyToOne<boost::shared_ptr<AnotherObject>,MyObject> + 0x19 bytes
d:\qxorm\inl\qxregister\qxclass.inl (91): myprogram.exe!qx::QxClass<MyObject>::relationManyToOne<boost::shared_ptr<AnotherObject>,MyObject> + 0x1E bytes
d:\projects\myprogramapp\ormclasses.cpp (192): myprogram.exe!qx::register_class<qx::QxClass<MyObject> > + 0x23 bytes
d:\qxorm\include\qxregister\qxclass.h (155): myprogram.exe!qx::QxClass<MyObject>::registerClass + 0x10 bytes
d:\qxorm\include\qxregister\qxclass.h (165): myprogram.exe!qx::QxClass<MyObject>::beforeRegisterClass
d:\qxorm\inl\qxregister\qxclass.inl (40): myprogram.exe!qx::QxClass<MyObject>::init
d:\qxorm\include\qxregister\qxclass.h (92): myprogram.exe!qx::QxClass<MyObject>::QxClass<MyObject> + 0xCC bytes
d:\qxorm\inl\qxsingleton\qxsingleton.inl (39): myprogram.exe!qx::QxSingleton<qx::QxClass<MyObject> >::getSingleton + 0x28 bytes
d:\qxorm\include\qxdao\qxsqlquerybuilder.h (252): myprogram.exe!qx::QxSqlQueryBuilder<boost::shared_ptr<MyObject> >::init + 0x5 bytes
0x5C6393D9 (File and line number not available): QxOrmd.dll!qx::QxSqlQuery::groupBy + 0x6A64E bytes
d:\qxorm\inl\qxdao\qxdao_helper_container.inl (61): myprogram.exe!qx::dao::detail::QxDao_Helper_Container<std::vector<boost::shared_ptr<MyObject>,std::allocator<boost::shared_ptr<MyObject> > > >::QxDao_Helper_Container<std::vector<boost::shared_ptr<MyObject>,std::allocator<boost::shared_ptr<MyObject> > > > + 0x50 bytes
d:\qxorm\inl\qxdao\qxdao_fetchall.inl (57): myprogram.exe!qx::dao::detail::QxDao_FetchAll_Container<std::vector<boost::shared_ptr<MyObject>,std::allocator<boost::shared_ptr<MyObject> > > >::fetchAll + 0x32 bytes
d:\qxorm\inl\qxdao\qxdao_fetchall.inl (111): myprogram.exe!qx::dao::detail::QxDao_FetchAll<std::vector<boost::shared_ptr<MyObject>,std::allocator<boost::shared_ptr<MyObject> > > >::fetchAll + 0x19 bytes
d:\qxorm\include\qxdao\qxdao.h (703): myprogram.exe!qx::dao::fetch_by_query<std::vector<boost::shared_ptr<MyObject>,std::allocator<boost::shared_ptr<MyObject> > > > + 0x5B Bytes


The Program itself runs normal. I user QxOrm in Version 1.2.2. Boost Version 1.48 and Qt 4.8!!
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am

Re: Memory Leak Question

Postby qxorm » Tue Mar 12, 2013 1:25 pm

Hi !

In the last line my Memory Leak Finder (Visual Leak Detector from codeplex Platform) says that there is a Memory Leak and i don't know why.
The last line is the last place on the stack trace which i wrote by myself. after that the stack goes Forward with qxorm and boost files.
Whats wrong? Where is my mistake?

I have my own memory leak detector and I try to release each QxOrm version without any memory leak.
I don't know why your Memory Leak Finder detects a memory leak with your code !
For me, your code is correct ;)
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Memory Leak Question

Postby QtConstruct » Tue Mar 12, 2013 2:11 pm

Thanks for your fast replay.
Hm i don't know what i can do now.
Do you think there is a chance when i update to 1.2.4 and a newer boost library?

How can i activate the Memory leak finder in qx orm lib?
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am

Re: Memory Leak Question

Postby qxorm » Tue Mar 12, 2013 2:40 pm

Sorry I don't know Visual Leak Detector, maybe you can just disable it !

Do you think there is a chance when i update to 1.2.4 and a newer boost library ?

For QxOrm 1.2.4, I don't think it will resolve your memory leak issue.
But I strongly recommend to update your QxOrm version (QxOrm 1.2.5 will be released very soon, so maybe you can wait for QxOrm 1.2.5 before upgrading).
For boost library, I don't know, you could try...

How can i activate the Memory leak finder in qxorm lib ?

I use QxMemLeak module only with MSVC2008 (I don't know if it's working fine with other compilers).
You can read the FAQ to enable it here : http://www.qxorm.com/qxorm_en/faq.html#faq_110

Or maybe the better thing to do is to try to understand why Visual Leak Detector detects a leak with your code.
You could ask in the Visual Leak Detector forum (http://vld.codeplex.com/discussions) showing your source code ?
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Memory Leak Question

Postby QtConstruct » Tue Mar 12, 2013 2:59 pm

Hallo qxorm...
thanks for your reply.

I wait for your new Version and ask in vld Forum, too!

One question i have. I want to recompile qxorm because auf the QxMem...Leak.

But it doesn't work anymore :(.

moc.exe had parse error at /boost/type_traits/detail/has_binary_operator.hp(50): Parse error at "BOOST_JOIN"

Is that a known error?
Many many thanks!
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am

Re: Memory Leak Question

Postby qxorm » Tue Mar 12, 2013 3:20 pm

I wait for your new Version and ask in vld Forum, too!

Great !
If you want to test the last BETA version of QxOrm library, you can download it here :
http://www.qxorm.com/version/QxOrm_1.2.5_BETA_11.zip

moc.exe had parse error at /boost/type_traits/detail/has_binary_operator.hp(50): Parse error at "BOOST_JOIN"
Is that a known error?

Nope, never see this error.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Memory Leak Question

Postby QtConstruct » Wed Mar 13, 2013 9:33 am

This Error occurs with Boost 1.53.

It works with my old Version 1.48.
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am

Re: Memory Leak Question

Postby QtConstruct » Wed Mar 13, 2013 9:39 am

I've compiled QXOrm with Memory Leak Detection.
When i put the QxMemLeak.h in my application it is crashing.
Without MemLeak Detection it works fine.

The console says:
[QxOrm] delete: invalid pointer 0x4bb5368
[QxOrm] **** Checking for memory corruption: START ****
[QxOrm] **** Checking for memory corruption: 0 FOUND ****

The Visual Studio Error Message is in attachment.

Do you know this error? Have i make a mistake?
Attachments
Microsoft Visual C++ Debug Library_2013-03-13_10-32-44.png
Microsoft Visual C++ Debug Library_2013-03-13_10-32-44.png (33.83 KiB) Viewed 10752 times
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am

Re: Memory Leak Question

Postby qxorm » Wed Mar 13, 2013 11:03 am

I think it's a bug in QxMemLeak module.
Sorry for that but this module is used only before releasing a new version of QxOrm library to avoid memory leak (and on only 1 dev environment MSVC2008 + boost 1.52 + Qt 4.7).
This module is disabled by default and I will not try to revolve those errors (too complex and not really a main feature of QxOrm library).

So you have to disable QxMemLeak module and keep the default QxOrm config file : sorry for that.
Wait for an answer to your question in Visual Leak Detector forum.
Or if you are able to build your application on Linux, try to execute Valgrind : the best memory leak detector !
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Memory Leak Question

Postby QtConstruct » Wed Mar 13, 2013 11:49 am

Okay. And with boost i take the older Version. The new does not work on my Environment because of the parse error. I use Visual Studio 2008 too!

Thanks for your help again.
QtConstruct
 
Posts: 6
Joined: Thu Oct 11, 2012 7:43 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron