How does the Garbage collector works? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

How does the Garbage collector works?

I understand that GC is a means to take care of memory, but what is it, as it is called and specifically what it does?

3rd Jun 2017, 2:47 PM
Paolo Torregroza
Paolo Torregroza - avatar
1 ответ
+ 1
It is nondeterministic in sense of when is it called, the framework does that every so often, you cannot really trigger it. Garbage collector pretty much goes through allocated memory and deletes (frees) every object which does not have a valid reference to it (unreachable).
3rd Jun 2017, 6:12 PM
Norbivar
Norbivar - avatar