Results 1 to 5 of 5

Thread: qxmlquery memory leak

  1. #1
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qxmlquery memory leak

    Hi all,

    i am using xquery to retrieve xml data in Qt with QXmlQuery but i realised that there are some memory leak with QXmlQuery. It looks like it failed to release some the memory it has allocated. I need to run xquery against a xml pretty frequent so the leak can get quite bad.

    Anyone else facing the leaking problem? What are the available open source libraries for xquery?

    thanks

  2. #2
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2
    Thanked 26 Times in 23 Posts

    Default Re: qxmlquery memory leak

    Can you show a code, please ( just a fragment, that that makes memory leak ). I'm using QXmlQuery and I don't want to have this problem in my program.
    Thanks

  3. #3
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qxmlquery memory leak

    do a simple setquery call multiple times in a loop and you can see it

  4. #4
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2
    Thanked 26 Times in 23 Posts

    Default Re: qxmlquery memory leak

    I wrote a simple example, run it and monitored memory by windows task manager. Then I remarked this code and view memory usage again, and I don't see any changes. I use Windows 7 + Qt 4.6.2 + MXVC2008. Here is my code.
    Qt Code:
    1. QByteArray byteArray = "<?xml version='1.0' encoding='Windows-1251'?>"
    2. "<widget>"
    3. "<property name='text'>Текст</property>"
    4. "</widget>";
    5. for ( int i = 0; i < 1000000; i++ )
    6. {
    7. QBuffer buffer( &byteArray );
    8. buffer.open( QIODevice::ReadOnly );
    9. QXmlQuery xmlQuery;
    10. xmlQuery.bindVariable( "myDocument", &buffer );
    11. xmlQuery.setQuery("string(doc($myDocument)/widget/property[@name='text'])");
    12. bool v = xmlQuery.isValid();
    13. QString sss;
    14. bool eee = xmlQuery.evaluateTo( &sss );
    15. buffer.close();
    16. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qxmlquery memory leak

    hi i am on fedora,

    memory increases fast , 1 thing to note is that my xml is huge...300 elements.
    I detected the leak using valgrind and monitor it using top command

    i will try to post my code snippet.

Similar Threads

  1. memory leak
    By mattia in forum Newbie
    Replies: 18
    Last Post: 16th January 2008, 10:22
  2. Memory leak?
    By Enygma in forum Qt Programming
    Replies: 10
    Last Post: 4th September 2007, 16:24
  3. Memory Leak in Qt
    By Krish_ng in forum Qt Programming
    Replies: 3
    Last Post: 22nd July 2007, 08:02
  4. Memory leak
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 2nd September 2006, 15:31
  5. Memory leak
    By zlatko in forum Qt Programming
    Replies: 8
    Last Post: 28th March 2006, 19:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.