Memory leak / static cache retention with PSD processing (v25.8)

Hello,

I’m experiencing what looks like a memory leak when using Aspose.PSD 25.8 in my production application. I work in the school and sports photography industry, and my application processes large volumes of PSDs to create package sheets.

Problem

  • Sports jobs in particular use many PSD templates, and the same PSDs are reused multiple times while creating packages.
  • As the job progresses, my application’s memory usage climbs steadily until most of the available RAM is consumed.
  • Profiling shows large numbers of PsdImage, Layer, ChannelInformation, and related objects staying alive. They appear to be retained through a static Dictionary<object,object> inside Aspose.PSD.
  • Even after I call Dispose() on every PsdImage and associated stream, memory is not released.

What I’ve tried

  • Verified that my code disposes every PsdImage, Stream, and any other disposable resource.
  • Disabled my own caching (I now only cache PSD bytes, not Aspose objects).
  • Forced .NET GC with LOH compaction after each batch — some memory is reclaimed, but most of the objects remain rooted.

Observation

Visual Studio’s memory profiler shows:

  • Roots leading back to Dictionary<object,object> [Static variable], with entries referencing PsdImage and its layers.
  • This suggests Aspose.PSD is internally caching or retaining PSD object graphs, and those caches are not being cleared on Dispose().

Question

  • Is this expected behavior?
  • Is there a supported way to clear or reset Aspose.PSD’s internal caches/dictionaries at a time of my choosing (for example, after finishing a set of packages)?
  • If not, is there a recommended strategy to prevent unbounded memory growth in long-running processes that repeatedly load many PSDs?

Any guidance or best practices would be appreciated.
Screenshot 2025-09-03 190939.png (51.2 KB)

Screenshot 2025-09-03 185346.png (9.5 KB)

@joshuasmith
We work on the investigation, to not to lose this issue, we have opened the following new ticket(s) in our internal issue tracking system with high priority and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2569

You can obtain Paid Support Url if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you, you guys are great! I haven’t tested the solution you gave me yet, but I appreciate your quick feedback. Hope you have a wonderful day!

@joshuasmith the answer from Containerize.Discourse is an automatic answer, I didn’t use API that it mentioned. It can be hallucination of neural network, so please forgive us in advance if the answer of a neural network doesn’t work or use non-existent API. The team works on your memory leak report.