What is the implication when i used 70% of methods of my web application as Static Methods? I am facing the System out of memory exception in my application. Is the static method cresting the 开发者_开发技巧problem or some thing else.
No, the use of static methods isn't causing the problem.
On the other hand, it does suggest that you haven't designed the system in a particularly OO way, which may make the problem harder to track down...
I suggest you get hold of a profiler (there are lots available) to work out what's using your memory.
If you're using lots of static fields - and some of those fields hold collections which you're only ever adding to - then that would be a problem, but static methods themselves don't require extra memory.
In addition to @Jon's post: static functions imply to use static members (collections, sets, stacks, whatever...) so during use of static members important to pay attention to free the data we never need more, or to not pump collections with unnecessary data, which is basic guideline for any type of program, but static type management is more "addicted" to fail in that kind of problems .
Regards.
精彩评论