By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Memory usage problems

P: n/a
I have a program with a couple datasets and a minimum number of controls.
The main form is a MDI container. The problem is that when the program
loads the memory in the working set shows 49 MB. If I minimize the
application and then restore it the usage drops to 9 or 10 MB. I have tried
everything to get the same result without ticking off a user by minimizing
and restoring evertime something happens in the application. What am I
missing? What does the program do when it's minimized that I can replicate
in code without minimizing?

Any help is appreciated.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Gene,

What you describe seems to me the wished behaviour from the managed code. It
frees memory when it is needed or when there is idle time and it let it stay
when there is enough memory. Result is that the processing goes on and the
computer is not spending time with useless cleaning.

However when you have real memory leaking. (It is never set to lower) than
you can look to this what Rich was feeding back to the newsgroup last week.

Before his investigation I had never heard of that problem.

http://www.google.com/gr************...TNGP12.phx.gbl

I hope this helps?

Cor

Nov 20 '05 #2

P: n/a
Thanks for the link. I found a few other mentions on the subject as well.
I found some code (VB) to reduce the Working Set to a minimum number as is
done when the app is minimized. I'm not real comfortable with it since this
writes out to the hard drive virtual mem to clear the memory but may put it
in as a flagged function if the WS reaches a large number during runtime.
Code:

Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal hProcess As IntPtr, _
ByVal dwMinimumWorkingSetSize As Int32,ByVal dwMaximumWorkingSetSize As
Int32) As Int32

Public Function SaveMemory() As Int32
Return _

SetProcessWorkingSetSize(Diagnostics.Process.GetCu rrentProcess.Handle, -1, -
1)
End Function
End Function

Thanks again!
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Gene,

What you describe seems to me the wished behaviour from the managed code. It frees memory when it is needed or when there is idle time and it let it stay when there is enough memory. Result is that the processing goes on and the
computer is not spending time with useless cleaning.

However when you have real memory leaking. (It is never set to lower) than
you can look to this what Rich was feeding back to the newsgroup last week.
Before his investigation I had never heard of that problem.

http://www.google.com/gr************...TNGP12.phx.gbl

I hope this helps?

Cor

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.