Log null interned string in SweepInterpreterCache() in debug-mode
Bug: 275005060
Test: manual
Change-Id: I5224125e36759005e9611bcb1cc284272af1bb71
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 335b365..094da2e 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -4477,22 +4477,19 @@
mirror::Object* new_object = visitor->IsMarked(object);
// We know the string is marked because it's a strongly-interned string that
// is always alive (see b/117621117 for trying to make those strings weak).
- if (new_object == nullptr) {
+ if (kIsDebugBuild && new_object == nullptr) {
// (b/275005060) Currently the problem is reported only on CC GC.
// Therefore we log it with more information. But since the failure rate
// is quite high, sampling it.
if (gUseReadBarrier) {
- static constexpr size_t kSampleRate = 5;
- if (MilliTime() % kSampleRate == 0) {
- Runtime* runtime = Runtime::Current();
- gc::collector::ConcurrentCopying* cc = runtime->GetHeap()->ConcurrentCopyingCollector();
- CHECK_NE(cc, nullptr);
- LOG(FATAL) << cc->DumpReferenceInfo(object, "string")
- << " string interned: " << std::boolalpha
- << runtime->GetInternTable()->LookupStrong(
- Thread::Current(), down_cast<mirror::String*>(object))
- << std::noboolalpha;
- }
+ Runtime* runtime = Runtime::Current();
+ gc::collector::ConcurrentCopying* cc = runtime->GetHeap()->ConcurrentCopyingCollector();
+ CHECK_NE(cc, nullptr);
+ LOG(FATAL) << cc->DumpReferenceInfo(object, "string")
+ << " string interned: " << std::boolalpha
+ << runtime->GetInternTable()->LookupStrong(Thread::Current(),
+ down_cast<mirror::String*>(object))
+ << std::noboolalpha;
} else {
// Other GCs
LOG(FATAL) << __FUNCTION__