Fix valgrind tests
Delete large objects in space destructor. Also some cleanup.
Change-Id: I4c4e90149841a156b7a3236201b37683e14890fb
diff --git a/runtime/thread.cc b/runtime/thread.cc
index ac3f089..5ca51fb 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1386,6 +1386,8 @@
visitor, RootInfo(kRootNativeStack, thread_id));
for (HandleScope* cur = tlsPtr_.top_handle_scope; cur; cur = cur->GetLink()) {
for (size_t j = 0, count = cur->NumberOfReferences(); j < count; ++j) {
+ // GetReference returns a pointer to the stack reference within the handle scope. If this
+ // needs to be updated, it will be done by the root visitor.
buffered_visitor.VisitRootIfNonNull(cur->GetHandle(j).GetReference());
}
}
@@ -2312,6 +2314,7 @@
ReleaseLongJumpContext(context);
for (instrumentation::InstrumentationStackFrame& frame : *GetInstrumentationStack()) {
visitor->VisitRootIfNonNull(&frame.this_object_, RootInfo(kRootVMInternal, thread_id));
+ DCHECK(frame.method_ != nullptr);
visitor->VisitRoot(reinterpret_cast<mirror::Object**>(&frame.method_),
RootInfo(kRootVMInternal, thread_id));
}