The application on our site worked fine until we deployed it to Windows Azure website. Sometimes this c# web application goes down because of out of memory exception. For me, it is unable to find from where this exception is coming out. Does anyone know why this might be happening and how I can troubleshoot this issue?
This article on XsPDF.com is what are you looking for, check out: Guide Center for XsPDF .NET SDK.
Answers
One of the known issue that we see these years is OutOfMemoryException scenarios. And in general, the Out Of Memory condition will appear in two situations. One is your process is using lots of memory, especially more than 800MB in a 32-bit environment. And the other is the virtual address space is fragmented, reducing the likelihood that a large, contiguous allocation will succeed.
There are many reasons that may cause the Out Of Memory exception. For example,
- An infinite loop may trigger the exception or if you explicitly load a large number of objects into an in-memory collection.
- It is quite necessary to limit the amount of data returned if your application use data from a database or other data source. Or it can easily cause high memory and lead to an Out Of Memory condition.
- As we all know, ASP.NET tracing uses data structures (like DataTable) to store trace information, and these can cause a high memory condition over time, which will give rise to Out Of Memory.
- If your application implements the IDisposable interface and you never call the Dispose method, you will have a risk of leaking native resources. Finally cause the Out Of Memory exception.
The issue with Windows Azure Shared Websites is that they do not support GDI+. So you are supposed to use Azure Cloud Service instead of Web Sites. Or you may firstly view and check the memory utilization in Azure new portal. And then move your c# web application to another web hosting that only has one web application.