IPXC_Document.WriteToFile Memory issue  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
jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

IPXC_Document.WriteToFile Memory issue

Post by jeffp » Tue Nov 15, 2016 5:46 pm

I'm running into a very strange issue.

My Delphi application memory size grows every time I call the following:

var
FDoc: IPXC_Document;
...
FDoc.WriteToFile(PChar(AFileName), nil, 0)

And even after a call to

FDoc.Close(0);
FDoc := nil;

The memory still is not freed up.

It appears that there is something in the IPXC_Document.WriteToFile call that is bloating memory. Is there something I need to call to clear the bloat?

I've attached a simple Delphi project that will recreate this issue for you.

--Jeff

--Jeff
Attachments
EditorDemo.zip
(4.28 MiB) Downloaded 31 times

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Wed Nov 16, 2016 9:28 am

Hello Jeff,

We've tested this. This is a normal program workflow - the memory was released after some time - we've opened the files 20 times or so and the garbage collector cleaned some of the memory used.

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Wed Nov 16, 2016 2:47 pm

You mean "saved" the file 20 times or so?

I guess I'm not following you here. On my end repeated saves of the file bloats the memory as indicated in the task manager. And it doesn't get released when I close the document.

What do you mean by the garbage collector? Usually in Delphi the developer is responsible for freeing memery.

Did you actually run the Delphi project I sent with my last email? Maybe it works fine in C# but there is an issue in Delphi.

This is a very serious issue for me since when I process scanned images in my app, I do a lot of saving. As such, if some scans for 20 minutes or so the memory of my app grows very high and is a concern.

Again, can we focus on the sample project I sent. I want to ensure you are seeing with it what I am on my end.

--Jeff

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Wed Nov 16, 2016 2:51 pm

Hello Jeff,

The memory began to release when it's bloated to the certain point (there is a memory limit for this). This behavior will be fixed in the next build 319.

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Wed Nov 16, 2016 3:23 pm

Can I get a dev release of the upcoming 319 build with the fix as soon as it is fixed?

Or is there something I can call in the meantime to force the memory cleanup after certain procedures that cause the memory bloat?

This is a big issue for my app so I'd like to test it asap.

What time frame are we talking here?

--Jeff

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Wed Nov 16, 2016 5:42 pm

Ok. Just playing with my test project again and here's what I am seeing.

Again, just saving the file out is causing a memory bloat, but once the memory of the exe gets to about 450,000K as measured by task manager, it seems to purge itself and goes back to about 50,000K. But (and this is very strange) thereafter it seems to clean itself up after every save going forward.

The big issue for me is that I can't have my app growing from 25,000K to 400,000K for no apparent reason. You'd be surprised at the number of our users that monitor this stuff.

--Jeff

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Thu Nov 17, 2016 11:34 am

Hello Jeff,

The Dev. Build is being deployed right now - should be available in a couple of hours.

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Thu Nov 17, 2016 1:28 pm

Would you mind giving me the link again. I'll bookmark it this time.

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Thu Nov 17, 2016 1:40 pm

You can see it on top of the Edior SDK and Core API forums named Useful Resources.
https://www.tracker-software.com/forum3 ... 66&t=25943

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Thu Nov 17, 2016 3:56 pm

Unfortunately, the new dev build does not appear to fix my memory bloat issue. I'm using the new PDFXEditCore.x86.dll marked as version 6.0.318.16083 on a Win7 machine. I've updated my sample project and posted it at the link below (let me know when you get it so I can remove it. Your attach button wasn't working);

http://www.lucion.com/files/MemoryTest.zip

Here's what you need to do to recreate the issue I'm seeing.

Just launch the Project1.exe file in the attached zip file and do the following:

Press the "Load Editor" button to load the editor. Note that after this the memory will be about 22,000K.

Now set the save test to 100 iterations and press the "Save Test" button. This will cause the program to open a simple PDF file and start saving it 100 times. Note that as the saves continue the memory grows. On my machine, after about 75 saves the memory is close to 450,000K. But shortly after that threshold, it drops back to about 57,000K and stays there for the rest of the saves.

Once the saves are done, the memory stays at around 57,000K.

What I'd expect to see is that the memory would climb a bit above the initial 22,000K during the save loop but it would be cleared after each save (no aggregate effect), and more importantly it would return to the initial 22,000K after the save test completes and the PDF doc is closed. This is what I observed with the older SDK DLLs before switching to the new Editor SDK.

Can you first see if you can reproduce what I described above with my sample project so we are on the same page.

Thanks,

Jeff

Lzcat - Tracker Supp
Site Admin
Posts: 712
Joined: Thu Jun 28, 2007 8:42 am

Re: IPXC_Document.WriteToFile Memory issue

Post by Lzcat - Tracker Supp » Fri Nov 18, 2016 7:33 am

Hi Jeff.
and more importantly it would return to the initial 22,000K after the save test completes and the PDF doc is closed
Unfortunately this will never happen because during opening documents editor use some more memory and will not release all of it - some common data will stay in memory. However these resources will be loaded only once, so new stable memory usage should be not much higher (in your case - around 57,000K).
About dev build - fix is not present there, this is why you see old behavior with memory growth.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Fri Nov 18, 2016 1:44 pm

When will this fix be in the dev build for me to test out?

I'm fine with the small increase in memory when the file opens. The bigger issue was the memory growth upon doing multiple saves, and it sounds like you are addressing this one.

--Jeff

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Fri Nov 18, 2016 2:00 pm

Hello Jeff,

The Dev Build will be prepared by Monday and it will contain this fix.

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Fri Nov 18, 2016 2:49 pm

Great. Thanks so much.

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Fri Nov 18, 2016 2:54 pm

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue

Post by jeffp » Mon Nov 21, 2016 3:40 pm

Did the dev build with this fix get posted?

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Mon Nov 21, 2016 3:44 pm

The build is being deployed right now - should be available in a couple of hours.

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

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Document.WriteToFile Memory issue  SOLVED

Post by jeffp » Mon Nov 21, 2016 7:04 pm

New dev build seems to have fixed this memory growth issue.

Much thanks.

--Jeff

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

Re: IPXC_Document.WriteToFile Memory issue

Post by Sasha - Tracker Dev Team » Mon Nov 21, 2016 7:40 pm

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

Post Reply