views:

215

answers:

2

Hello,

I have a small WCF service which is executed on an XP box with 256 megs of RAM running in VM. When I make a request to that service (request size approx 5mbs) I always get following message in event log:

aspnet_wp.exe was recycled because memory consumption exceeded the 153 MB (60 percent of available RAM).

and call fails with err 500. I've tried to increase memory limit to 95% but it still takes up all available memory and fails in same manner.

Looks like something is wrong with my app (I do not reuse byte[] buffers and maybe something else) but I can not find root cause of such memory overuse. Profiling showed that all CLR objects that I have in memory together do not take up that much space. Dump analysis with windbg showed same situation - nothing that big in object heap. How can I find out what is contibuting to such memory overuse? Is there any way to make a dump right before process is recycled (during peak mem usage)?

+1  A: 

Could be a lot of things, hard to diagnose this one. Have you watched perfmon to see if the memory usage does peak on aspnet process or on the server itself? 256MB is pretty low, but it should still be able to handle it. Do you have a SWAP file on this machine? AT what point do you take the memory dump? Have you stepped though the code, and does it work on other machines? Perhaps it is getting stuck in a loop and leaking memory until it crashes?

Mike Ohlsen
+2  A: 

Tess Ferrandez's blog "If broken it is, fix it you should" has lots of hints, tips and recommendations for sorting out exactly this sort of problem.

Of particular use to you would be Lab 3: Memory, where she walks you through working out what has caused all the memory on your machine to disappear.

Zhaph - Ben Duguid
I learned quite a lot using Tess's walkthroughs and the debug tools. It's definitely worth your time.
Chris Porter
Thanks. Did not really fix this one as I was told that we wont have such poor machines in production and memory does not seem to leak. Anyway - I've implemented my own MultiBufferMemoryStream that implements IXmlSerializable :D
Nikolay R