Asked by:
Memory leak in asp.net mvc site

Question
-
User-980557072 posted
Good day !
My asp.net mvc website grows to 3 GB in 15-30 minutes and restarts. I'm ready provide technical details and must know what details need.
IIS: 10.0.14393.0
MVC: 4.0
Thanks !
Friday, March 27, 2020 8:02 PM
All replies
-
User303363814 posted
What objects are being created by your app? How are you disposing of them?
Friday, March 27, 2020 9:36 PM -
User-980557072 posted
The site is e-shop. The main functionality: viewing the product catalog, product selection, purchase.
I'm using Dapper as ORM for access to database:<package id="Dapper" version="1.50.2" targetFramework="net45" />
Like a wrapper for a dapper, i'm using DataBaseHelper<T>Saturday, March 28, 2020 7:40 PM -
User753101303 posted
Hi,
Make sure Dispose is called for all disposable objects. Even in VS Community you should have https://docs.microsoft.com/en-us/visualstudio/profiling/memory-usage?view=vs-2019 to trach memory usage on yout machine and see what is kept in memory.
Saturday, March 28, 2020 8:22 PM -
User-980557072 posted
Good day !
My disposable objects is disposed.
'Private bytes' level grows (Private_butes.png). I did dumps with 'gflags -i w3wp.exe +ust' option and analyzed them with DebugDiag Analysis.In dumps i see stack like:
clrjit!CodeGen::genCreateAndStoreGCInfoX64+141 f:\dd\ndp\clr\src\jit\codegenxarch.cpp @ 8484 + 8
clrjit!CodeGen::genGenerateCode+2c1 f:\dd\ndp\clr\src\jit\codegencommon.cpp @ 3383
clrjit!Compiler::compCompile+755 f:\dd\ndp\clr\src\jit\compiler.cpp @ 4680
clrjit!Compiler::compCompileHelper+2c2 f:\dd\ndp\clr\src\jit\compiler.cpp @ 5810
clrjit!Compiler::compCompile+202 f:\dd\ndp\clr\src\jit\compiler.cpp @ 5153 + 1d
clrjit!jitNativeCode+270 f:\dd\ndp\clr\src\jit\compiler.cpp @ 6451 + 50
clrjit!CILJit::compileMethod+a2 f:\dd\ndp\clr\src\jit\ee_il_dll.cpp @ 299
Is there a memory leak in the native code?
Sunday, March 29, 2020 8:20 PM -
User-17257777 posted
Hi eddy_cs,
I analyze the dump file and find one request excuate more than 15 sec
And it is related to the getproductlist() method, how much data does it retuen? Also, you can check if there is any problem in it.
Best Regards,
Jiadong Meng
Monday, March 30, 2020 9:54 AM -
User-980557072 posted
Hi Charles !
I'm not using EF in this site at all. I will analyze models to find navigation property.Thank you!
Monday, March 30, 2020 7:43 PM -
User-980557072 posted
Hi Jiadongm !
I will reseach method "GET /devicemodel.....".
Thank you !Monday, March 30, 2020 7:47 PM -
User753101303 posted
A bit later it shows how to take a snapshot and then you can get a report with the number and size of objects for each object type which should help to figure out what is kept in memory. You could do that when testing on your VS machine.
If you want to analyze a memory dump coming from a production machine, VS Enterprise does this out of the box or if you don't have this option in your VS edition you could try https://snede.net/hunting-net-memory-leaks-with-windbg/
It should help to figure out quite quickly which objects are taking that much memory...
Monday, March 30, 2020 9:03 PM -
User409696431 posted
You might want to read https://www.meadow.se/wordpress/debugging-a-memory-leak-in-an-asp-net-mvc-application/ which has a description of tools and approaches used to track down a memory leak that was showing up in Private Bytes. The specific cause of the leak my not be related to yours, but you might find help in the approach.
Thursday, April 2, 2020 4:53 PM