I am using Syncfusion.Pdf.Net.Core(Version:21.1.41) to generate PDF from MemoryStream.
But memory is not released after I tried with different way.
Here is the logic, any idea how to release the memory after the process?
// Save the PDF document to stream
var stream = new MemoryStream();
doc.Save(stream);
// If the position is not set to '0' then the PDF will be empty.
stream.Position = 0;
// Close the document.
doc.Close(true);
stream.Close();
stream.Dispose();
stream.SetLength(0);
stream.Capacity = 0;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();