Yahoo Interview Question

How to implement a garbage collector in C?

Interview Answer

Anonymous

Dec 2, 2013

Have a mandatory init() for each object. Keep count of variables and increment on init(). Then implement retain() and release() to increment and decrement counts. Delete object from memory when count reaches 0.