c# - If GC does its job why do we get Out of Memory Exceptions? -


Normally I'm told that 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?

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? Private zoo (foo) {// do my_DICTIONARY work with MY_DICTIONARY = null //? // Ahh! Free memory or not? }

This is not enough if you put a reference on your code somewhere: // Somewhere far away COPY_DICTIONARY = MY_DICTIONARY; ..... MY_DICTIONARY = Faucet; // inial dictionary will not be released because referencing the COPY_DICTIONARY object

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -