c# - Why calling GC.Collect() multiple times free some memory that usually isn't cleaned? -


i found out weird thing in gc, when have application removed reference many large objects, still eats lot of ram, in case around 300mb. memory not cleaned if call gc.collect()

then tried randomly call 10 times in few seconds, , result: 200mb of ram freed resulting in application eating 100mb instead of 300mb of private ram (not virtual physical / resident ram)

why this? how can make gc clean memory automatically without having call hand?

either:

  1. you still holding onto reference large object somewhere, calling gc.collect can't clean up.

  2. there unmanaged memory accounts majority of memory consumed. not disposing of unmanaged resource.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -