Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: Source/platform/heap/Heap.cpp

Issue 1042263002: Oilpan: Make Oilpan crash at a never-inlined function when hitting OOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index 4c926046975308c5c4fe16a4dcdd2f0a24cbad6c..aa66e457007aaf5135d5081ec2e40f07adb8490f 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -170,6 +170,24 @@ private:
size_t m_size;
};
+// TODO(haraken): Like partitionOutOfMemoryWithLotsOfUncommitedPages(),
+// we should probably have a way to distinguish physical memory OOM from
+// virtual address space OOM.
+static NEVER_INLINE void blinkGCOutOfMemory()
+{
+#if OS(WIN)
+ // Crash at a special address (0x9b)
+ // to be easily distinguished on crash reports.
+ // This is because crash stack traces are inaccurate on Windows and
+ // blinkGCOutOfMemory might be not included in the stack traces.
+ reinterpret_cast<void(*)()>(0x9b)();
+#endif
+
+ // On non-Windows environment, IMMEDIATE_CRASH is sufficient
+ // because blinkGCOutOfMemory will appear in crash stack traces.
+ IMMEDIATE_CRASH();
+}
+
// A PageMemoryRegion represents a chunk of reserved virtual address
// space containing a number of blink heap pages. On Windows, reserved
// virtual address space can only be given back to the system as a
@@ -248,7 +266,8 @@ private:
// Round size up to the allocation granularity.
size = (size + WTF::kPageAllocationGranularityOffsetMask) & WTF::kPageAllocationGranularityBaseMask;
Address base = static_cast<Address>(WTF::allocPages(nullptr, size, blinkPageSize));
- RELEASE_ASSERT(base);
+ if (!base)
+ blinkGCOutOfMemory();
WTF::setSystemPagesInaccessible(base, size);
return new PageMemoryRegion(base, size, numPages);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698