memory tracker implementation and memory leakage elimination