Free classes after objects for memory tool

Since the memory tool space calls Object::SizeOf, we need to free
classes after instances to prevent reading stale data.

Bug: 131542326
Test: art/test/testrunner/run_build_test_target.py -j50 art-gtest-heap-poisoning

Change-Id: I4b0583b2456e8db23ae3cd19ef6495bff955e7dc
2 files changed