|
You may want to try GC.WaitForPendingFinalizers() as well. It's a perfomance killer and not recommended in most situations, but it could be interesting to see if it changes the memory usage you see in task manager.
|
|
|
|
|
Learn how memory work under the .NET CLR.
What you're seeing in Task Manager, which is a lousy place to look for memory usage by the way, you're seeing what memory the .NET CLR has reserved for your app. Your app may not be using all of this memory, but it's sitting in the .NET CLR Managed memory pool, waiting for your app to allocate some memory for objects or whatnot. When you minimize your app, the .NET CLR looks to see if there is any memory in the Managed Pool that isn't being used by your app and, from what it can tell, isn'tgoing to be used anytime soon. If so, this memory is taken out of the Managed Pool and returned to Windows.
Basically, you're worried about nothing. The .NET CLR is very good at managing it's memory and cooperating with Windows. If Windows needs memory back from the .NET CLR, the CLR is more than happy to scan it's pools to see what it can return to Windows.
...entirely automatically. You don't need to do anything.
|
|
|
|
|
Dave Kreskowiak wrote:
What you're seeing in Task Manager, which is a lousy place to look for memory usage by the way, you're seeing what memory the .NET CLR has reserved for your app. Your app may not be using all of this memory, but it's sitting in the .NET CLR Managed memory pool, waiting for your app to allocate some memory for objects or whatnot.
Expanding upon this; The CLR does it because asking for more memory from the kernel is an expensive operation, it's much faster to ask for a large block up front than to keep asking for little bits as needed. Also when system memory starts getting low, windows will go around asking applications if they can return extra unused memory. When this happens the same thing will occur as when you minimize the application.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
//below is my code , i want to add one entry
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("AppDomain.CurrentDomain.BaseDirectory +"..\\..\\App.config");
// Get the count of the Application Settings.
int appStgCnt = config.AppSettings.Settings.Count;
string asName = "AppStg" + appStgCnt.ToString();
// Add an Application Setting.
config.AppSettings.Settings.Add(asName,
DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");
but instead of writing in app.config , it creates another app.config.config file, so why is it so??????
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
modified on Tuesday, September 16, 2008 5:02 AM
|
|
|
|
|
Mogaambo wrote: System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("..\\..\\App.config");
is this path valid? Try to give full executable path or use the other overload ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel)
|
|
|
|
|
Yes it is, if i give wrong path then it gives error,
i used this way
(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\App.config")
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Check out this on MSDN[^]. It has an example doing what you want. The main page is in VB but scroll down to the community content section and someone has posted a C# translation. I've just tried it and it works.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
//I tried this code but the result is not reflecting in app.config
//WHY
// Get the configuration file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an entry to appSettings.
int appStgCnt = ConfigurationManager.AppSettings.Count;
string newKey = "NewKey" + appStgCnt.ToString();
string newValue = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
config.AppSettings.Settings.Add(newKey, newValue);
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of the changed section.
ConfigurationManager.RefreshSection("appSettings");
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Sorry about that - my bad! That example uses yourexename.config if release or yourexename.vshost.exe.config if debug.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Because it's Microsoft. They provide HUGE amounts of stuff but none of it actually works properly.
|
|
|
|
|
I had set the DetectUrls property of the richtextbox object to true. When I typed an URL address, the address would be automatically underlined and the color of the font would be in blue and when ever I move the cursor over the address, it will change from an "I beam" to a "hand".
However, when I clicked the url, nothing happened. I expected the Internet Explorer 's window to pop out. Can anyone tell me what should I do ?
|
|
|
|
|
Use the LinkClicked event of the RichTextBox and put in something like this:
System.Diagnostics.Process.Start(e.LinkText);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
You're welcome
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
what?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
He wants an "assing". Usually, you have to go to the gay side of town (or prison) for that.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
i have created a mail message object as
MailMessage ReadMail=New MailMessage();
i have a ndoc of type domino.notesdocument which i am assigning to ReadMail
ReadMail = (MailMessage)nDoc;
i no its an invalid cast...Can ne1 plz tell me how to cast it???
|
|
|
|
|
preetpal wrote: ndoc of type domino.notesdocument
Cast will succeed if domino.notesdocument is a subclass of MailMessage . If not how you are expecting a valid cast?
|
|
|
|
|
thx...i really dont have any clue on how to do....
can u suggest me any way???
|
|
|
|
|
Your question is not clear. Why do you want to cast something which is not mailmessage to MailMessage ?
|
|
|
|
|
You need to create a static method on your MailMessage class that tells the framework how to convert a lotes message to the MailMessage that you've created.
public static explicit operator MailMessage(NotesDocument nDoc)
{
//add your conversion code here
}
|
|
|
|
|
Hi,
how can I simple focus previous textbox when up arrow key pressed.
When down key pressed I use SendKeys.Send("{TAB}").
thanks,
Jure
|
|
|
|
|
Tavbi wrote: SendKeys.Send("{TAB}").
Shift + Tab is the key to go back to the previous focus. I am not sure, but it will be something like
SendKeys.Send("+{TAB}")
|
|
|
|