Memory increasing in MVC3
I've been stresstesting a very simple MVC3 example where the controller returns an EmptyResult.
I set up 5 threads in jMeter t开发者_如何学Gohat constantly hit the Controller action that returned the EmptyResult and monitored the memory usage in PerfMon (# bytes on all heaps).
The strange thing I see is that the it's increasing. From 30MB to 75MB in about 15 minutes.
Is this normal? Should I worry?
How do you know its leaking?
Maybe the GC hasn't completed recently because the CPU is so busy. Maybe its storing session variables, maybe its not recycling threads immediately. Maybe there is no need for the GC to run when there is plenty of memory available. There are lots of explanations
If you monitor the GC, and see lots of full GC events AND the memory use still sky rocketing maybe it means something, but simply seeing the total bytes on the heap going up is a long way from a smoking gun. It's normal for RAM to be used.
Unless its crashing and/or the app-pool is constantly recyling I'd let it slip your mind and move onto other things.
It is normal and you shouldn't worry, however if you want to dig a bit deeper you can create a memory dump using the task processor (Right click on the process -> Create Full Userdump) or use the Microsoft Debug Diagnostics Tools.
Windbg (part of the Debugging Tools for Windows) can then show you what is currently in memory, how many threads are running, what the garbage collector is currently doing etc.
There is a nice tutorial on howto start by Tess Ferrandez http://vimeo.com/9936296
Useful links: http://windbg.info/doc/1-common-cmds.html http://kentb.blogspot.com/2007/11/windbg-sos-cheat-sheet.html http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx
精彩评论