We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Memorystream is not released after GC.Collect()

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();

            // If the position is not set to '0' then the PDF will be empty.
            stream.Position = 0;

            // Close the document.

            stream.Capacity = 0;


1 Reply

IJ Irfana Jaffer Sadhik Syncfusion Team April 20, 2023 12:08 PM UTC

After examining the reported issue with the Visual Studio diagnostic tool, we observed that the memory did not decrease even after calling the GC collect. Upon further investigation, we discovered that the memory profiler is not compatible with the ASP.NET platform within Visual Studio. For more information, please consult the following link.


Live Chat Icon For mobile
Up arrow icon