diff options
-rw-r--r-- | perfetto_hprof/perfetto_hprof.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/perfetto_hprof/perfetto_hprof.cc b/perfetto_hprof/perfetto_hprof.cc index b13e5e15ce..318b890498 100644 --- a/perfetto_hprof/perfetto_hprof.cc +++ b/perfetto_hprof/perfetto_hprof.cc @@ -913,6 +913,7 @@ void ForkAndRun(art::Thread* self, std::optional<art::gc::ScopedGCCriticalSection> gcs(std::in_place, self, art::gc::kGcCauseHprof, art::gc::kCollectorTypeHprof); + DCHECK(self->IsSuspended()); std::optional<art::ScopedSuspendAll> ssa(std::in_place, __FUNCTION__, /* long_suspend=*/ true); pid_t pid = fork(); @@ -1033,7 +1034,7 @@ void DumpPerfetto(art::Thread* self) { }); } -void DumpPerfettoOutOfMemory() { +void DumpPerfettoOutOfMemory() REQUIRES_SHARED(art::Locks::mutator_lock_) { art::Thread* self = art::Thread::Current(); if (!self) { LOG(FATAL_WITHOUT_ABORT) << "no thread in DumpPerfettoOutOfMemory"; @@ -1048,6 +1049,8 @@ void DumpPerfettoOutOfMemory() { } g_oome_triggered = true; } + + art::ScopedThreadSuspension sts(self, art::ThreadState::kSuspended); // If we fork & resume the original process execution it will most likely exit // ~immediately due to the OOME error thrown. When the system detects that // that, it will cleanup by killing all processes in the cgroup (including |