I had a test by open and closing 10+ screens, my app consumed 200+MB from task manager. And according to the tool .Net Memory Profiler and ANTS Memory Profiler, the objects created by my screens are actually ok-to-collected.
If Windows wants the memory back, the .NET CLR is more than happy to collect and return as much as it can. The GC will also run whenever it gets a sense that it "can" and/or needs to. It's, really, very good at its job. You can see an example of this just by watching the Task Manager and launching your app, then minimizing it.
The CLR will try to keep a pool of memory (managed heaps) available for your apps object allocations. Objects that are collected get the memory returned back to the managed heap, NOT to Windows. This keeps allocation speeds fast compared to allocating a block of memory from Windows, adding it to the heap, and then allocating your object. If the memory is already in the heap, there's no round-trip to Windows to get the memory first.
What Task Manager is showing you is how much memory is RESERVED by the .NET CLR for your app, not how much your app is actually using. But, like I said, if Windows needs the memory back for any reason, the .NET CLR is more than happy to give as much back as it can. You really don't need to worry about what you see in Task Manager. It's not representative of what your app is actually doing and should not be used to generate your applications system requirements.
If you have third-party plugins or are using old (unmanaged) code this might be the culprit.
I'm pretty sure you can write .Net (managed) code that has memory leaks, but in that case you probably did something funky. I doubt standard WPF code has memory leaks.
Long ago, I run into OutOfMemory exceptions when doing a lot of graphics operations. After adding some calls to the Garbage Collection, especially GC.WaitForPendingFinalizers();, the problems were gone, the maximum memory use was reduced to less than a tenth of the capacity of the computer. My impression is that garbage collection just happens to slowly in such a case.
k i wil say clearly..........i hav added an image in panel preview box..it is displayed in list view also......after i made selection in list view...i must move the image with mouse pointer and must resize the image with mouse pointer...............
Hi, so I'm having trouble with my coding. I've already figured out for to take money from Tom and Rob, but i can't figure out how to deposit that value into the bank. here's what i have so far.
I would really appreciate it if, someone would take a look.
public partial class Form1 : Form
//Add your form1 variables
decimal bank = 50M;
//Initialize (create) Tom and Rob
Tom = new Person();
Tom.Name = "Joe";
Tom.Cash = 150M;
btnGetOne.Text = "Get from " + Tom.Name;
Rob = new Person();
Rob.Name = "Bob";
Rob.Cash = 200M;
btnGetTwo.Text = "Get from " + Rob.Name;
public void UpdateForm()
lblFirstName.Text = Tom.Name;
lblMoneyOne.Text = Tom.Cash.ToString();
//What do i put here to add to bank after subtracting from Rob?
MessageBox.Show("Rob doesnt have this many!");
MessageBox.Show("Please enter numbers only!");
This is the other part defining the class
publicdecimal ReceiveCash(decimal amount)
if (amount > 0)
// person money punched in
Cash -= amount;
MessageBox.Show(amount + " isnt an amount I'll take",
Name + " says..");
i am new in this encoding decoding stufs and i have some problem.
I work on VS 2012 ASP.NET c#.
My problem is that i need to create CheckSum value from some input string. The length of the CheckSum need to be 16 bytes (32 characters) long like this one: "8A303F3E0CB4F8A9CDA5AC120F9B90A4".
The encryption need to be done using a pass key for example TEST_PASS and this key will be used latter to be decrypted this hash value....
hope you understand what i ask and what i need pls help me
Look again at the specs for encryption/decryption. That looks trather like a multistep step procedure:
- user enters password
- system generates salt
- system generates hash from salted password and derives both CheckSum and actual password for encryption
- system stores salt and CheckSum in the encrypted file
- system encrypts input file with the actual password generated above.
When you want to decrypt the file, you can check the password by calculating the CheckSum. The decrpytion algorithm might work with a wrong password too, just producing a nonsense output...
First, MD5 is a cryptographics HASH, NOT an encryption.
Second, it's a ONE-WAY hash. There is no such thing as "decrypting a hash". In theory, you cannot get the original content back from a hash value.
Lastly, MD5 is considered broken and should no longer be used in production code. It just doesn't take that much computing power to break it in todays world. Also, two different pieces of content CAN produce the same hash value using MD5!
Use something a bit stronger, like SHA512 instead and use proper salting techniques to make it even harder to break.
I'm not surprised it's not working. As a small point, could you please post code that stands a chance of compiling. There isn't a HttpWebRequest.Create - it's WebRequest.Create.
Your problem here is that you are just reading the data into a stream, which you then dispose of. What do you think the stream at the server end is going to do? You actually need something there to take that stream and write it out to a file. That's the part you're missing here.
I was brought up to respect my elders. I don't respect many people nowadays.