c# - If GC does its job why do we get Out of Memory Exceptions? -
Normally I'm told that At present, I am coming closer to another scenario which can be out of memory. I have a class level dictionary of some classes list, it has 200,000 keys in it at a global level. So I had to keep it in one of my ways I needed this, but as soon as I am done with that method, I want to empty my place. Is it sufficiently set to null? This is not enough if you put a reference on your code somewhere: GC is very clever and messy than all of us It's not so, so I'm thinking when the memory gets reduced and releases memory for the program. Okay then why do I sometimes get out of memory exceptions on big things?
Private zoo (foo) {// do my_DICTIONARY work with MY_DICTIONARY = null //? // Ahh! Free memory or not? }
// Somewhere far away COPY_DICTIONARY = MY_DICTIONARY; ..... MY_DICTIONARY = Faucet; // inial dictionary will not be released because referencing the COPY_DICTIONARY object
Comments
Post a Comment