Amazon interview question

how will you implement garbage collector in c++