Commit d293bf54 authored by marja's avatar marja Committed by Commit bot

Fix OOM handling on a background thread.

We don't have an Isolate, so we cannot use it for retrieving data or
calling the embedder's OOM handler. So just crash.

BUG=5525

Review-Url: https://codereview.chromium.org/2427623002
Cr-Commit-Position: refs/heads/master@{#40363}
parent f5d333c2
......@@ -274,10 +274,23 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
i::Isolate* isolate = i::Isolate::Current();
char last_few_messages[Heap::kTraceRingBufferSize + 1];
char js_stacktrace[Heap::kStacktraceBufferSize + 1];
i::HeapStats heap_stats;
if (isolate == nullptr) {
// On a background thread -> we cannot retrieve memory information from the
// Isolate. Write easy-to-recognize values on the stack.
memset(last_few_messages, 0x0badc0de, Heap::kTraceRingBufferSize + 1);
memset(js_stacktrace, 0x0badc0de, Heap::kStacktraceBufferSize + 1);
memset(&heap_stats, 0xbadc0de, sizeof(heap_stats));
// Note that the embedder's oom handler won't be called in this case. We
// just crash.
FATAL("API fatal error handler returned after process out of memory");
return;
}
memset(last_few_messages, 0, Heap::kTraceRingBufferSize + 1);
memset(js_stacktrace, 0, Heap::kStacktraceBufferSize + 1);
i::HeapStats heap_stats;
intptr_t start_marker;
heap_stats.start_marker = &start_marker;
size_t new_space_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment