logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
mhook  
#1 Posted : Wednesday, September 25, 2019 1:14:14 PM(UTC)
mhook

Rank: Newbie

Groups: Registered
Joined: 9/25/2019(UTC)
Posts: 1
Italy

I am evaluating the Pdfium.Net for use in my organization and was surprised by a memory failure. The test PDF is a large file, ~200 pages of an industrial supply catalog, in which I am searching for a large number of products. This means iterative searches and a high percentage of searches that return no results.

I've reduced the code to the following and the memory leak continues. A single execution of this routine and process memory rises 750 MB. However, if I replace the search text with a value that is actually on the page, the process memory change is negligible.

I interpret this to mean that PdfText.Find() is not disposing of resources when it returns null (i.e., no results).

Is there another way I can structure my search to avoid the problem? Is this a bug that can be fixed quickly? I am testing with version 4.17.2704 downloaded through NuGet just now.

Code:

private void button1_Click(object sender, EventArgs e)
{
    PdfCommon.Initialize();

    catalog = PdfDocument.Load(textBoxCatalogFile.Text);

    PdfPage page = catalog.Pages[4];

    for (int i = 0; i < 100000; i++)
    {
        PdfFind results = page.Text.Find("NotOnThePage", FindFlags.MatchWholeWord, 0);
        if (results != null)
        {
            // Do something

            results.Dispose();
        }
    }

    page.Dispose();

    catalog.Dispose();
}


Thank you
Paul Rayman  
#2 Posted : Thursday, September 26, 2019 12:17:11 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 814

Thanks: 1 times
Was thanked: 100 time(s) in 98 post(s)
Fixed.
https://forum.patagames....n-Sep--26--2019#post1795

Thanks a lot for bug report!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.