I have the following code which uses a third party library called Aspose.Words:
SaveOptions saveOptions = SaveOptions.CreateSaveOptions(SaveFormat.Docx);
saveOptions.MemoryOptimization = true;
saveOptions.TempFolder = Path.GetTempPath();
var mm = new RecyclableMemoryStreamManager();
using (RecyclableMemoryStream ms = new RecyclableMemoryStream(mm))
{
doc.Save(ms, saveOptions);
return ms.ToArray();
}
I hit the following error on the using statement.
Mvc.ExceptionHandling.AbpExceptionFilter - Exception of type 'System.OutOfMemoryException' was thrown.
I'm unable to reproduce it locally (my memory usage goes up by perhaps 200mb while its processing so it doesn't really use much memory). The file itself is only 56MB in size. I'm told by Aspose it could use up to 10 times that amount... even still it should be fine. I've altered the Service plan to scale up to 14GB of memory.
I'm using RecyclableMemoryStreamManager because I already tried it with MemoryStream to no avail.
What else could I do to problem solve this issue that I'm only hitting in Azure (dev & production)? Azure API is .net core stack and has a platform of 64bit.
Thanks in advance.