Algar Posted August 7, 2003 Posted August 7, 2003 (edited) I have a small VB.Net application, couple small forms. Main form has a ListView, Listbox, statusbar, main menu and a 100k jpg. The load event populates the listbox and listview controls with 2-3 items each from an access db. The following is the memory at variouse stages: After Load: 21 megs Move form around screen: 22 megs Minize form:600k Maximize form: 4 megs Move form around screen: 4.1 megs Minimize form:600k Maximize form: 4 megs etc... The Virtual Memory remains a constant 10.5 megs at all times. I dispose the connection object and close the DB reader... why does it hog so much at first and reduce so much when minimimzed ? I read a previous post from a long time ago about someone having the same problem as myself, though it never really got solved so I thought I'd try now. Edited August 7, 2003 by Algar Quote
donnacha Posted August 8, 2003 Posted August 8, 2003 There are several recent threads on this memory subject, the jist of them is tha while it looks to be using less memory when minimised, it is not, it has written the data to disk instead of holding it in memory. when you maxamise it again, it will quickly get back to the origional amount. The whole memory management is very scarey to say the least.... Quote Hamlet
Algar Posted August 8, 2003 Author Posted August 8, 2003 Ok, well then that explains the vast difference, but still leaves the question of how could 1 small form take up 22 megs right after being loaded ? Quote
donnacha Posted August 8, 2003 Posted August 8, 2003 I presume a large % of this comes from loading the CLR or else it is a business arrangment between Microsoft and the memory manufacturers. Have you tried calling the GC direct to free any unused memory(Gc.Collect) it might help. As well as using Dispose, add setting the variable to 'Nothing' Quote Hamlet
Algar Posted August 8, 2003 Author Posted August 8, 2003 Sorry, whats CLR ? I am closing, disposing, setting all object to Nothing, forcing the collect at the end of the load, and its still the exact same. Quote
*Experts* mutant Posted August 8, 2003 *Experts* Posted August 8, 2003 CLR is, I guess you could say, the whole engine of the .NET framework. It manages memory of .NET apps and all the .NET applications. CLR stands for Common Language Runtime. Read more about it here: http://msdn.microsoft.com/netframework/technologyinfo/overview/ Quote
*Gurus* Derek Stone Posted August 8, 2003 *Gurus* Posted August 8, 2003 http://www.xtremedotnettalk.com/showthread.php?s=&threadid=69454#post368172 Quote Posting Guidelines
Winston Posted August 8, 2003 Posted August 8, 2003 yes this is the basic theory the more ram in the system in which its not being consumed the more ram the application itself reserves weird but it's a fact you would notice if you ran that 22 meg app on a 64 megs of ram PC, it would probably use only 200k primarily because there isnt enough ram there is a way to get around this which is to use the SetProcessWorkingSize function which can show the "Real" memoru usage my app used around 34 megs but after calling this function on the form activate and deactivate events it refreshes it to the real memory size which is 1 .2 megs basically the task manager itself IMO is just decieving. Quote
donnacha Posted August 12, 2003 Posted August 12, 2003 Hi Winston, do you have an example of the call to SetProcessWorkingSize and is there an extra component to be added to allow it to work. I see it does not work with Win 98. Thanks Quote Hamlet
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.