Dear Support,
I am evaluating the product Aspose.Diagram with a temporay license.
I am using the .NET-package via the NuGet-package Aspose.Diagram (Version 22.8.0) in VS2022 on Windows 10 x64 (latest version).
One aspect of the evaluation is save a diagram to svg. I have tested this in a loop with 60.000 diagrams and I am quite impressed about the results. No exceptions at all, however I had to use the ‘garbage collector’ freeing resources (otherwise I got OutOfMemoryExceptions throwed from Aspose.Diagram).
I used the following code to prevent the OutOfMemoryExceptions:
var vsdFiles = System.IO.Directory.EnumerateFiles(sourceDirectory, "*.vsd", System.IO.SearchOption.AllDirectories);
int count = 0;
foreach (var vsdFile in vsdFiles)
{
string vsdBaseFileName = System.IO.Path.GetFileNameWithoutExtension(vsdFile);
string svgFileName = $"{vsdBaseFileName}.svg";
string svgPath = System.IO.Path.Combine(targetDirectory, svgFileName);
try
{
using (Diagram diagram = new Diagram(vsdFile, LoadFileFormat.Vsd))
{
diagram.Save(svgPath, SaveFileFormat.Svg);
}
if (count % 100 == 0)
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
count++;
}
catch (Exception ex)
{
Console.WriteLine(vsdFile + ":" + ex.Message);
}
}
Using the Garbage Collector to prevent OutOfMemoryExceptions feels to me as a smell.
Could you investigate this issue, please?
With Kind Regards,
Thierry Knijff
Software Engineer