call gc.collect() after data.clear() to release memory as much as
possible.