Click here to Skip to main content
16,006,535 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to check object==null for objects without Constructor? Pin
whizzs4-Nov-05 7:27
whizzs4-Nov-05 7:27 
QuestionLoading Files Pin
zaboboa4-Nov-05 5:53
zaboboa4-Nov-05 5:53 
AnswerRe: Loading Files Pin
User 66584-Nov-05 7:32
User 66584-Nov-05 7:32 
GeneralRe: Loading Files Pin
zaboboa4-Nov-05 8:13
zaboboa4-Nov-05 8:13 
AnswerRe: Loading Files Pin
whizzs4-Nov-05 7:37
whizzs4-Nov-05 7:37 
AnswerRe: Loading Files Pin
Jon Rista4-Nov-05 16:16
Jon Rista4-Nov-05 16:16 
Questionget GC to collect unused memory Pin
Stefan Fohringer4-Nov-05 5:06
Stefan Fohringer4-Nov-05 5:06 
AnswerRe: get GC to collect unused memory Pin
Dan Neely4-Nov-05 5:32
Dan Neely4-Nov-05 5:32 
Stefan Fohringer wrote:
the application starts with about 6mb memory.
when the last messagebox is displayed, everything should be disposed and the memory should return nearly to 6mb. but it doesn't.

has anyone any idea how to get the GC to collect this unused (but reserved?) memory?
i have to engineer a little application which will run on a terminalserver for each user. (50users x 10mb unneccessary memory is not very good...)



You're misunderstanding the way the memory model works. After the GC runs, memory from collected objects is placed in the application heap. It is not immediately returned to the OS, for the same reason that standard win32 apps don't (doing so involves a major performance hit from the context switch). Excess unused memory will be freed eventually under certain conditions, the ones I'm aware of are the app being minimized, the OS asking the app if it can do so (ie when the system needs more than is currently available), when the app has was the GC determines to be an excessive ammount. I'm not sure what the rules on this one are, but apps that breifly allocated hundreds of megs will rapidly return it following a GC. I don't know what size/time thresholds are involved here.

PS this comes up often enough it should probably be faqed somewhere.
AnswerRe: get GC to collect unused memory Pin
Dave Kreskowiak4-Nov-05 5:52
mveDave Kreskowiak4-Nov-05 5:52 
GeneralRe: get GC to collect unused memory Pin
Jon Rista4-Nov-05 16:33
Jon Rista4-Nov-05 16:33 
GeneralRe: get GC to collect unused memory Pin
Dave Kreskowiak5-Nov-05 2:49
mveDave Kreskowiak5-Nov-05 2:49 
GeneralRe: get GC to collect unused memory Pin
Jon Rista5-Nov-05 9:57
Jon Rista5-Nov-05 9:57 
QuestionMost elegant way to query 400 computers in C#? Pin
artisticcheese4-Nov-05 4:44
artisticcheese4-Nov-05 4:44 
AnswerRe: Most elegant way to query 400 computers in C#? Pin
Rob Graham4-Nov-05 5:14
Rob Graham4-Nov-05 5:14 
GeneralRe: Most elegant way to query 400 computers in C#? Pin
artisticcheese4-Nov-05 5:17
artisticcheese4-Nov-05 5:17 
AnswerRe: Most elegant way to query 400 computers in C#? Pin
S. Senthil Kumar4-Nov-05 21:39
S. Senthil Kumar4-Nov-05 21:39 
GeneralRe: Most elegant way to query 400 computers in C#? Pin
artisticcheese5-Nov-05 2:31
artisticcheese5-Nov-05 2:31 
GeneralRe: Most elegant way to query 400 computers in C#? Pin
S. Senthil Kumar5-Nov-05 3:17
S. Senthil Kumar5-Nov-05 3:17 
QuestionRemoting - recovering communication Pin
duff794-Nov-05 4:37
duff794-Nov-05 4:37 
QuestionAny good C# 2.0 books out yet? Pin
Ed K4-Nov-05 3:46
Ed K4-Nov-05 3:46 
QuestionUnTrapping of Mouse Events Pin
wheelerbarry4-Nov-05 3:38
wheelerbarry4-Nov-05 3:38 
AnswerRe: UnTrapping of Mouse Events Pin
Dave Kreskowiak4-Nov-05 5:47
mveDave Kreskowiak4-Nov-05 5:47 
QuestionRichtextbox Pin
PaulaM4-Nov-05 2:38
PaulaM4-Nov-05 2:38 
AnswerRe: Richtextbox Pin
mav.northwind4-Nov-05 2:49
mav.northwind4-Nov-05 2:49 
QuestionHTTP Protocols C# Pin
TAREQ F ABUZUHRI4-Nov-05 1:29
TAREQ F ABUZUHRI4-Nov-05 1:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.