Free Support Forum - aspose.com

'System.OutOfMemoryException' occuring while serializing presentation into a stream

Hi Team,

We are using Aspose.Slides dll of version 6.9.0.0

After building a presentation while serializing it to stream we recieved 'System.OutOfMemoryException'. Kindly let us know when does this issue occur( Note: The presentation size is of 47MB and contains 504 slides).

Also, the code attached build the final Output.ppt from a group of presentations.

After downloading it, while opening the ppt we are facing the issue as attached below(Issue.jpg).

When the reports are reduced we are able to open the generated Ouput.ppt.

Kindly look into the mentioned issues and let us know your comments.

Note: The presentation files used in the code are present in the zipped file.

Thanks,

Koundinya P

Hi Koundinya P,


I have observed the sample code shared and have made some small modification in that. I have used Aspose.Slides for .NET 7.4.0 on my end have not been able to observe both OutOfMemory and presentation repair issues on my end. Please try using the following sample code using Aspose.Slides for .NET 7.4.0 on your end.

public static void TestKoundinyaCloningIssue()
{
String path = @“D:\Aspose Data\Presentions”;
Presentation m_Presentation = new Presentation();

Presentation sourcePresentation1 = new Presentation(path+“ReportPage_1.ppt”);
Presentation sourcePresentation2 = new Presentation(path + “ReportPage_2.ppt”);
Presentation sourcePresentation3 = new Presentation(path + “ReportPage_3.ppt”);
Presentation sourcePresentation4 = new Presentation(path + “ReportPage_4.ppt”);
Presentation sourcePresentation5 = new Presentation(path + “ReportPage_5.ppt”);
Presentation sourcePresentation6 = new Presentation(path + “ReportPage_6.ppt”);
Presentation sourcePresentation7 = new Presentation(path + “ReportPage_7.ppt”);
Presentation sourcePresentation8 = new Presentation(path + “ReportPage_8.ppt”);

System.Collections.SortedList sList = new System.Collections.SortedList();

for (int j = 0; j < 4; j++)
{
for (int i = 0; i < sourcePresentation1.Slides.Count; i++)
{
sourcePresentation1.CloneSlide(sourcePresentation1.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation2.Slides.Count; i++)
{
sourcePresentation2.CloneSlide(sourcePresentation2.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation3.Slides.Count; i++)
{
sourcePresentation3.CloneSlide(sourcePresentation3.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation4.Slides.Count; i++)
{
sourcePresentation4.CloneSlide(sourcePresentation4.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation5.Slides.Count; i++)
{
sourcePresentation5.CloneSlide(sourcePresentation5.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation6.Slides.Count; i++)
{
sourcePresentation6.CloneSlide(sourcePresentation6.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation7.Slides.Count; i++)
{
sourcePresentation7.CloneSlide(sourcePresentation7.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
sList = new System.Collections.SortedList();
for (int i = 0; i < sourcePresentation8.Slides.Count; i++)
{
sourcePresentation8.CloneSlide(sourcePresentation8.Slides[i], m_Presentation.Slides.LastSlidePosition + 1, m_Presentation, sList);
}
}

try
{
MemoryStream stream = new MemoryStream();
m_Presentation.Write(path + “Output.ppt”);
m_Presentation.Write(stream);
}
catch (Exception es)
{
String err=es.StackTrace;

}
}


Many Thanks,