Optimized memory tracking (biggest issue noticed on debug/android, now fixed)