DjVu Model consumes a lot of memory when searching

Bug #1381812 reported by Razi Alavizadeh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Medium
Adam Reichold

Bug Description

Hello Adam,
Tonight when working on search-model I found out that search consumes lots of megabytes!! After some testing and updating to revision before "Merge search model" I saw the issue was present there! Then I saw problem is not present when searching through PDF documents, then it should be just DjVu model affected by this issue.

Best Regards,
Razi.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Razi,

have you tried running a search using Valgrind? It should tell whether it is a proper leak or just DjVuLibre deciding to keep stuff around.

Best regards, Adam.

Revision history for this message
Adam Reichold (adamreichold) wrote :

A simpler check might also be whether repeated search is able to continuously increase memory consumption or whether it will plateau, i.e. whether this is exessive caching or really a leak. (Initial tests here failed since DjVuLibre seems to crash under Valgrind...) (And please, the bug report could! do! with! less! exclamation! marks!!! We are not Yahoo... ;-))

summary: - DjVu Model has memory leak when searching!
+ DjVu Model consumes a lot of memory when searching
Revision history for this message
Razi Alavizadeh (srazi) wrote : Re: [Bug 1381812] Re: DjVu Model consumes a lot of memory when searching

Hello Adam,

 have you tried running a search using Valgrind? It should tell whether it
> is a proper leak or just DjVuLibre deciding to keep stuff around.

Unfortunately Valgrind is not available on Windows. I didn't find an
alternative, yet.

 A simpler check might also be whether repeated search is able to
> continuously increase memory consumption or whether it will plateau, i.e.
> whether this is exessive caching or really a leak. (Initial tests here
> failed since DjVuLibre seems to crash under Valgrind...)

I wrote "leak" because I tested it in this way. Hmm... didn't you affected
by this bug?

Before search: (Memory measured by Windows Task Manager) 30MB
I searched a phrase that I know has 1311 occurrences:
After first search: 60 MB
Second time: 83 MB
Third time: 119 MB
.
10th time: 310 MB

 (And please, the bug report could! do! with! less! exclamation! marks!!!
> We are not Yahoo... ;-))

:-D
It's just my bad habit :-| (I also have it when I'm writing in my native
language)

Best Regards,
Razi.

2014-10-16 21:06 GMT+03:30 Adam Reichold <email address hidden>:

> A simpler check might also be whether repeated search is able to
> continuously increase memory consumption or whether it will plateau,
> i.e. whether this is exessive caching or really a leak. (Initial tests
> here failed since DjVuLibre seems to crash under Valgrind...) (And
> please, the bug report could! do! with! less! exclamation! marks!!! We
> are not Yahoo... ;-))
>
> ** Summary changed:
>
> - DjVu Model has memory leak when searching!
> + DjVu Model consumes a lot of memory when searching
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1381812
>
> Title:
> DjVu Model consumes a lot of memory when searching
>
> Status in qpdfview:
> New
>
> Bug description:
> Hello Adam,
> Tonight when working on search-model I found out that search consumes
> lots of megabytes!! After some testing and updating to revision before
> "Merge search model" I saw the issue was present there! Then I saw problem
> is not present when searching through PDF documents, then it should be just
> DjVu model affected by this issue.
>
> Best Regards,
> Razi.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qpdfview/+bug/1381812/+subscriptions
>

--
Alavizadeh, Sayed Razi
My Blog: http://pozh.org
Saaghar (نرم‌افزار شعر): http://saaghar.pozh.org/
Saaghar Fan Page: http://www.facebook.com/saaghar.p
Saaghar Mailing List: http://groups.google.com/group/saaghar

Revision history for this message
Razi Alavizadeh (srazi) wrote :

Oops... it seems Leon was wrong, because when I re-used the following lines at the end of "DjVuPage::search()", the leak was fixed:

    {
        QMutexLocker globalMutexLocker(m_parent->m_globalMutex);

        ddjvu_miniexp_release(m_parent->m_document, pageTextExp);
    }

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again Razi,

my bad for following the advice, sorry about that. I brought explicit release of miniexp back and use the opporunity to minimally refactor the DjVu model. Trunk revision 1753 should contain the fix. Could verify that this solves the problem for you?

Best regards, Adam.

Changed in qpdfview:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Adam Reichold (adamreichold)
milestone: none → 0.4.13
Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.