simple gc implementation for cpp