0

My C# application has a large working set size compared to the size of private memory. Private bytes are 20 MB and the working set size is 160 MB. Because of this large working set, the commit charge is getting high and when it exceeds a particular percentage, the app crashes.

Is it advisable to use SetProcessWorkingSetSize to limit the working set size of the app? Will this reduce the working set size? What would happen when the working set exceeds the amount specified in SetProcessWorkingSetSize?

user3164883
  • 91
  • 3
  • 8
  • I apologize for the typos. You're certainly well within your rights to rollback my changes if you prefer your original revision. If those two mistakes bother you but you're content with the rest of the changes, you can also [edit] to fix the post. – jerry Jan 08 '14 at 06:26
  • no worries.Is it possible for you to answer the question.It is an emergency. – user3164883 Jan 08 '14 at 06:36
  • As for your question, no, I would not suggest shrinking the working set size. Commit charge includes the pages resident in RAM as well as those paged out to disk. If your problem truly stems from having too high of a commit charge, you won't fix your problem. – jerry Jan 08 '14 at 06:36
  • What error message or exception do you get when the app crashes? `System.OutOfMemoryException`? Can you reproduce it while debugging? – jerry Jan 08 '14 at 06:39
  • Yes I am getting System.OutOfMemoryException and there are too many objects in Gen2 Heap. How would I overcome this problem? Please advice. – user3164883 Jan 08 '14 at 06:45
  • And is there a way to see how much memory is consumed by each DLL file? Of course I can see the DLLs in Process Viewer.But it doesn't give me the memory consumption details. – user3164883 Jan 08 '14 at 06:46
  • Unfortunately I can't say why you're running out of memory. It could be a memory dependency that's causing data to stick around after the last point it's actually used. It could be you really do have that much live data. As for seeing DLL memory usage, see [this question](http://stackoverflow.com/questions/9793391/tools-to-analyzing-the-memory-footprint-of-native-dlls-and-assemblies-loaded-in) – jerry Jan 08 '14 at 14:17

0 Answers0