ASP.NET Unmanaged Memory Leaking

Viewed 1190

At my company we are developing an ASP.NET web-application. The application itself utilizes a large number of number input elements at the frontend (~ 8k) which are in a table. Using these input fields the user can edit data in a spreadsheet-like manner. The code for generating the spreadsheet is essentially a nested for-loop.

The problem we are experiencing is that the application has ~12MB of memory usage when deployed. After the first page request the usage increases to over 100MB and stays there. Each follow-up request increases the memory usage until it reaches 700-1000MB. At that point the application will run GC cycles every 150-200ms, but only a few MB will be freed each time. If a user spams the refresh button they can get the site to crash with an OutOfMemoryError.

Visual Studio Diagnostics

The origin of the error is in the table generation code of our Razor template. When analyzing the memory usage with dotMemory it turned out that most of the memory is unmananged. The strange thing is that the heap is only 6 MB large. We are pretty clueless as to what is causing this. The code for generating an input element is simply @Html.EditorFor(model => ...). Any help or pointers in the right direction would be greatly appreciated. dotMemory Snapshot dotMemory #2

0 Answers
Related