Hi,
We are having a memory leakage problem. Our application uses Aspose.PSD lib to load a PSD file and update some layers and save that file as JPEG image. Memory usage starts to increase with the use of this functionality.
We made a test application that proves that problem exists (AppLink).
Code sample:
static void Execute(int index)
{
string psdName = $"AsposeTestApp.testPsd{index}.psd";
Console.WriteLine("Loading {0}", psdName);
using MemoryStream outputStream = new();
using Stream psdStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(psdName)
?? throw new Exception("Resource not found!");
using PsdImage psd = (PsdImage)Image.Load(psdStream, new PsdLoadOptions { LoadEffectsResource = true });
psd.Save(outputStream, new JpegOptions() { Quality = 100 });
}
Calling this method multiple times causes to memory start growing. The test scenario uses 3 different psd files in the for loop (files are also provided in testApp).
Memory diagram:
image.png (53.2 KB)
While profiling we notice that there is some static dictionary (probably some cache) holding reference to the objects (see picture below).
image.png (33.2 KB)
This problem is causing OutOfMemoryException in our application and we don’t know how to avoid it.