implement GC to clear events