Usage of Cpu and Outofmemory Exception
We have a web application based on asp.net 1.1. We deployed it on a web server but there is a problem about it. In the webserver sometimes cpu usage is increasing to 100% and outofmemory exception is occuring.
I think there are some wrong code inside the project but i don't know where it's.
Now, i want hear your advices about how to 开发者_StackOverflow中文版find problem and what kind of codes make cpu usage increased.
it looks like the garbage collector is not doing its work as supposed for some reason. i suggest to look in the code where you have variable declarations inside long loops. for example you need to check for loops that look like this:
dim c as car
for i as integer = 0 to 20
c= new car
c.brand=""
Next
the above loop creates a lot of garbage so make sure to call dispose()
when you finish using an object.
another issue to check for is recursion. if you have recursive calls, make sure to check that the breaking condition is correct and make sure to call dispose()
too before jumping in the next recursion.
If you have no idea how to debug something once it's deployed, the first place you should look to learn is Tess Ferrandez's blog. Click, and read. A lot. :) May I suggest you start with the debugging labs.
精彩评论