Page 1 of 1

Loading settings causes memory leak

Posted: Tue Jan 09, 2018 10:53 am
by MartinCS
Hi Tracker-Team,

using your FullDemo solution the activeX control causes a memory leak when loading the settings multiple times:

Code: Select all

private void btnSettLoad_Click(object sender, EventArgs e)
{
	try
	{
		PDFXEdit.IOperation op = pdfCtl.Inst.CreateOp(pdfCtl.Inst.Str2ID("op.settings.import"));
		op.Params.Root["Options.History"].v = ckSettIncHist.Checked;
		op.Params.Root["Input"].v = fsInst.DefaultFileSys.StringToName(tSettFile.Text);
		op.Do();

		UpdateDocumentsOpts();
	}
	catch { }
}
The application freezes and the process memory increases up to 3GB:
09-01-_2018_11-51-02.jpg
I hope you can solve this issue as I do need to load/switch settings when the program is running and tabs are getting changed by the user.

// Martin

Re: Loading settings causes memory leak

Posted: Wed Jan 10, 2018 7:16 am
by MartinCS
Hi,

I tested the import of the settings with the previous SDK version 6.0.322.7 and I don't experience the issue here.

// Martin

Re: Loading settings causes memory leak

Posted: Wed Jan 10, 2018 1:09 pm
by Sasha - Tracker Dev Team
Hello Martin,

I've tested different scenarios - no leaks or memory growth were found. Are you switching between different settings or just clicking Load?

Cheers,
Alex

Re: Loading settings causes memory leak

Posted: Wed Jan 10, 2018 1:26 pm
by MartinCS
Hi Alex,

I'm switching between different settings files (*.xces). I do have the problem only with the latest version. The previous version 6.0.322.7 doesn't have this issue running the same code when importing *.xcs files.

// Martin

Re: Loading settings causes memory leak

Posted: Thu Jan 11, 2018 7:28 am
by Sasha - Tracker Dev Team
Hello Martin,

If you can, please make a small sample that switches between two of yours settings file in a cycle or something that will illustrate a leak. Then I can give this project to the appropriate developer for investigation.

Cheers,
Alex

Re: Loading settings causes memory leak

Posted: Thu Jan 11, 2018 2:30 pm
by MartinCS
Hi Alex,

I created a sample project using the lastest PDF Editor SDK:

COM name: PDFXEdit.PXV_Inst
API version: 1.9.0.0 (0x01090000)
Full path: "C:\Program Files (x86)\Tracker Software\Editor SDK\Bin\PDFXEditCore.x86.dll"
File version: 7.0.323.2

The development computer has Windwos 10 installed with the latest Microsoft updates.

I also included a short video showing you how the memory increases after each switch. I want to point out that the memory increases also when there are no switches commited.

I hope this helps finding the issue.
18-01-11_Sampleproject.zip
(2.86 MiB) Downloaded 84 times
// Martin

Re: Loading settings causes memory leak

Posted: Fri Jan 12, 2018 12:59 pm
by Tracker Supp-Stefan
Hi Martin,

Alex is away till Monday, so he has asked me to let you know that he will be able to look at this once he is back!

Regards,
Stefan

Re: Loading settings causes memory leak  SOLVED

Posted: Mon Jan 15, 2018 1:42 pm
by Sasha - Tracker Dev Team
Hello Martin,

Thanks for the sample project - we've found the trouble in our code (the newly introduced Places View registered 2 events each time thus the event handlers array grew with 2^n speed). We will fix this bug and the fix itself will be available from the next build.
As for your project, I've found an optimization for you - the settings are being loaded 2 times in 1 RB change - you should check whether the RB is selected or not - not just changed.

Cheers,
Alex

Re: Loading settings causes memory leak

Posted: Tue Jan 16, 2018 5:14 am
by MartinCS
Hi Alex,

I'm happy that you've been able to find bug in your code! I'll be waiting for the next release.

// Martin

Re: Loading settings causes memory leak

Posted: Tue Jan 16, 2018 7:59 am
by Sasha - Tracker Dev Team
Make sure to optimize your code as well ;)

Cheers,
Alex