Jump to content
KlingonTarg

300MB/day memory leak, consumes more RAM on exit

Recommended Posts

Leaving Affinity Photo 1.8.3.641 on Windows 10 Pro (64-bit) running overnight (and not doing anything for many days) results in a roughly 300MB per day memory leak.  After 10 days of just running in the background, Affinity used almost 3GB RAM according to Task Manager.  I only had about a half-dozen SVGs open.

When I closed Affinity down, it appeared to *allocate* an additional 3GB RAM while it was shutting down - reaching around 6.5GB RAM usage at peak.  I have 32GB RAM, so it was able to cleanly shut down without hitting swap, but that's still kind of ridiculous.  Probably some internal references not being released, so those resources are never freed until application shutdown.  Most memory leak detection tools won't pick those kind of leaks up.

Share this post


Link to post
Share on other sites
21 minutes ago, KlingonTarg said:

Probably some internal references not being released, so those resources are never freed until application shutdown.  Most memory leak detection tools won't pick those kind of leaks up.

Well it always depends on the tools, the way they work and how you use them in your development workflow and stress testing cycles etc. Basically there are a bunch of tools which can assist in this regard, also expecially for C++. - Just a few of them ...

However, there are sometimes also circumstances, where some memory leaks then are possibly inside reused third party code (libs, modules, frameworks) and thus inside foreign developed code. Such things are then sometimes harder to detect/find and also to fix, especiall if you don't may have the sources of the third party code or due to it's possible complexity. - As said it always depends.


☛ Affinity Designer 1.8.3 ◆ Affinity Photo 1.8.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

All leak detection tools detect memory leaks based on memory no longer being attached to something.  Some tools let you measure between two segments of code if you instrument the code manually.  If an object uses reference counting and it gets into a circular reference situation, it can become nearly impossible to free the object until the application closes AND memory leak detection tools generally won't detect it because it DOES get freed when the application exits.

I'm saying there is a 300MB per day memory leak in Affinity Photo that needs to be tracked down.  That's a pretty significant leak.

Share this post


Link to post
Share on other sites

In case of circular reference of occupied but no longer used and not freed mem (possible dangling pointers etc.) it's indeed always a bad thing to handle in graceful manner. If detected and narrowed down, such code would need some amount of code restructuring/refactoring to overcome at all. - I wonder that it needed (allocated) additional 3GB of RAM in your case to shut down at all.


☛ Affinity Designer 1.8.3 ◆ Affinity Photo 1.8.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

It's possible that the OS had shunted unused pages to disk and was just reloading them on exit to free up space.  In which case, the bug would be more along the lines of 600MB per day (i.e. an even bigger leak).  I'm just reporting what I saw in the hopes that the devs take a look at it.

Share this post


Link to post
Share on other sites
On 5/4/2020 at 12:48 AM, KlingonTarg said:

Leaving Affinity Photo 1.8.3.641 on Windows 10 Pro (64-bit) running overnight (and not doing anything for many days) results in a roughly 300MB per day memory leak.  After 10 days of just running in the background, Affinity used almost 3GB RAM according to Task Manager.  I only had about a half-dozen SVGs open.

When I closed Affinity down, it appeared to *allocate* an additional 3GB RAM while it was shutting down - reaching around 6.5GB RAM usage at peak.  I have 32GB RAM, so it was able to cleanly shut down without hitting swap, but that's still kind of ridiculous.  Probably some internal references not being released, so those resources are never freed until application shutdown.  Most memory leak detection tools won't pick those kind of leaks up.

It's a bit hard to comment without trying to reproduce that behaviour here first. However I will say that it is hard to diagnose whether the application is "leaking" by looking at task manager. We cache plenty of data, in RAM, and on disk, and we're aware of your system's RAM size so can throttle accordingly. 6.5GB out of 32GB doesn't seem that bad for peak usage either, but there's a possibility we're doing some extra work on shutdown that might cause a spike. We'll investigate and see if we can reproduce.

Share this post


Link to post
Share on other sites

I have had the same problem. Affinity 1.8.3.641 with Windows 10 Pro 16GB RAM. 1 image open, left overnight and system crashed with swap file full. This has happened before but now I'm sure that it is Affinity Photo as nothing else was running.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.