Initialize the JNI indirect ref table to make Valgrind happy.
Specifically, this is to eliminate the benign warning about the
'serial' field being uninitialized.
BUG: 5542417
Change-Id: I8550972e70db94f24c47c4e5dea0b59cc5840b48
diff --git a/vm/IndirectRefTable.cpp b/vm/IndirectRefTable.cpp
index e6d0a7e..c38458d 100644
--- a/vm/IndirectRefTable.cpp
+++ b/vm/IndirectRefTable.cpp
@@ -38,9 +38,7 @@
if (table_ == NULL) {
return false;
}
-#ifndef NDEBUG
memset(table_, 0xd1, initialCount * sizeof(IndirectRefSlot));
-#endif
segmentState.all = IRT_FIRST_SEGMENT;
alloc_entries_ = initialCount;
@@ -116,6 +114,9 @@
return NULL;
}
+ memset(newTable + alloc_entries_, 0xd1,
+ (newSize - alloc_entries_) * sizeof(IndirectRefSlot));
+
alloc_entries_ = newSize;
table_ = newTable;
}