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

.net not releasing memory

P: 19
Hi guys,
I have a memory problem in my vb.net application. It's actually a point of sales system, which must be keep running the whole day.
The problem is: application is not releasing any memory that it allocates for any resources.
When my application starts it loads a form say frmLogin, at this time the memory used by my application is for example 67K.
Now when user enters his credentials an MDI form is loaded, causing memory to increase upto 80K.
Now even when user closes the MDI form the memory doesnt decrease, between after closing MDI frmLogin is shown.

I have tried every thing, called .Dispose method, set MDI object to nothing but still of now use.
One thing i also mention here I am closing frmLogin when MDI is loaded and similary MDI is closed using .Close method after loading frmLoing.
Dec 2 '09 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 750
PRR
Are you having problems wrt to memory consumption? Garbage collection automatically manages memory. You can use dispose method for classes that implement IDisposable.
Dec 3 '09 #2

P: 1
GC is automatic and like most automatic things its a litle dumb and sometimes needs a little help.

I found my app was wasting abou 400MB in memory holding a List<>. To release it I needed:
1. Explicit clear te object, if it is a list: myList.Clear(); myList = null;
2. Call the Garbage Collector: GC.Collet();

In fact most of times objects falls in a "grey area" where the GC cannot guess if it ill be referenced or not.
Exiting the block of code where myList lives dont free it and calling the GC ill not (immediatly) clean the memory. You must explicit "nullify" the object while inside scope (ie. inside te loop, if or method)! You can call the GC at any time after the object is correctly "nullified".
Jan 11 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.