Loading settings causes memory leak  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Loading settings causes memory leak

Post by MartinCS » Tue Jan 09, 2018 10:53 am

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
Last edited by MartinCS on Wed Jan 10, 2018 7:20 am, edited 2 times in total.

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Loading settings causes memory leak

Post by MartinCS » Wed Jan 10, 2018 7:16 am

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4316
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Loading settings causes memory leak

Post by Sasha - Tracker Dev Team » Wed Jan 10, 2018 1:09 pm

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Loading settings causes memory leak

Post by MartinCS » Wed Jan 10, 2018 1:26 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4316
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Loading settings causes memory leak

Post by Sasha - Tracker Dev Team » Thu Jan 11, 2018 7:28 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Loading settings causes memory leak

Post by MartinCS » Thu Jan 11, 2018 2:30 pm

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 33 times
// Martin

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13533
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Loading settings causes memory leak

Post by Tracker Supp-Stefan » Fri Jan 12, 2018 12:59 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4316
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Loading settings causes memory leak  SOLVED

Post by Sasha - Tracker Dev Team » Mon Jan 15, 2018 1:42 pm

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Loading settings causes memory leak

Post by MartinCS » Tue Jan 16, 2018 5:14 am

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4316
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Loading settings causes memory leak

Post by Sasha - Tracker Dev Team » Tue Jan 16, 2018 7:59 am

Make sure to optimize your code as well ;)

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply