Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
How to free up memory in C# apps?
Name: Leo the 28C (by Sulfurik) Date: June 6, 2005 at 16:50:13 Pacific OS: Windows XP SP2 CPU/Ram: 2.8 GHz/448 MB
Comment:
Hello everyone! :D OK, I made a program, and I've been looking at Task Manager while I use the program, and I've been seeing that each time I open a file (even though I close the StreamReader after I use it...) or click something, the mem. usage increases! How do I fix this? How can I free mem. space? By the way, isn't 16+ MB of RAM for a text editor too much? Thanks! ;)
Name: Chi Happens Date: June 7, 2005 at 08:27:09 Pacific
Reply:
C# will collect the garbage and clear out memeory for you, but the more you use static types (such as string) the more space will be allocated as your program runs.
If you want to force garbage collection, set your objects to - null when you are done with them.
For forms, you can call Dispose and then set it to null.
Hope this helps, Chi
0
Response Number 2
Name: Leo the 28C (by Sulfurik) Date: June 7, 2005 at 21:48:44 Pacific
Reply:
Well, I set all the StreamReaders/Writers, Save/OpenFileDialogs, etc, to null, but it still takes more memory each time I go to open/save a file... How can I fix this? Thanks! ;)
Summary: Hello all. Newbie to C. I have some questions about some of the memory allocation functions in C. 1) This is if you are adding memory to an allocated block: Does the realloc(ptr, NUM + 1) function aut...
Summary: Hi, I don't know how to do the following because I don't know how to use the string array in C++. Please Help!!! Thanx! #include <iostream.h> #include <string.h> class pizza { private: char**...
Summary: I have the nasty error "The program has generated errors and will be closed by Windows" when the user closes my application. Does anybody know how to disable the error messages on the user's computer ...