Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
I have a problem with random(?) OutOfMemory Exceptions.
We have a pretty big application running at a customer. The complete application has about 100 forms, but no user is allowed to see/open them all.
Some users are only allowed to open a few forms.
And some of these users sometimes get OutOfMemory Exceptions. Sometimes when they have lots of forms open, sometimes when they only have a few open.
I've checked the stacktraces for the exceptions and they are completely random (no one method seems to cause the error). Although a lot seems to be related to the drawing of (DevExpress) Controls. Also, less often, the Entity Framework is involved.

Some forms show A LOT of data (like REALLY 1000s of large database records). The customer does not want paging and they really want to see all those records. The exceptions do not seem to be related to this though... (Or does it?)

I've already checked if every Disposable object is actually disposed and as far as I can see most of them are.

I cannot reproduce the issue (I was at one point in a specific Form, but got that fixed).
As said the Exception occurs sometimes and for different users. I can't really see a pattern like 'if user A opens form X and form Y and performs action Z then... '.

Is there any way to track where and when these Exceptions occur and why?
I'd like to see this fixed as our customer is currently seeing this about once a week (with about 60 users).

Thanks.
Posted

1 solution

The first thing I'd do is make sure there's nothing running on the customer machine that is consuming memory or large numbers of handles, reducing these resources for your application. I ran into a problem with a Dell service that was running and it was leaking handles badly it eventually made everything run a bit wonky until Windows crashed.

The next thing run PerfMon with various .NET counters to monitor things like Memory use and Handle counts on your application. Yes, you can have OutOfMemory exceptions without running the machine out of memory. Exhausting the handle pool with also throw those kind of exceptions.

You might even add some instrumentation code to your app to log what activities are going on and track what is happening and how much data is being returned by various methods.

You said that they want large record sets and want to display them all. This is suspect. Did you use Virtual mode on these grids? If not, you may wnat to look into how big these data sets are and you may be forced to use paging. .NET has a limit on how big any one object can be in memory, 2GB. So, you may be running into that as well.

This is going to take time and a lot of research to solve. There is no "quick fix" possible with a problem like this.
 
Share this answer
 
Comments
Sander Rossel 28-Feb-14 11:23am    
Hi Dave,
Thanks for your reaction. I'll take your advice into account.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900