Chromium Code Reviews| Index: Source/wtf/PartitionAlloc.cpp |
| diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp |
| index ab14a4328f122cd7b2e7b56e31c6fc83aadc98c6..4ef6197579c4092d3f19df52ffbce38cecd1551f 100644 |
| --- a/Source/wtf/PartitionAlloc.cpp |
| +++ b/Source/wtf/PartitionAlloc.cpp |
| @@ -296,8 +296,16 @@ bool partitionAllocGenericShutdown(PartitionRootGeneric* root) |
| return noLeaks; |
| } |
| -static NEVER_INLINE void partitionOutOfMemory() |
| +static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) |
| { |
| + if ((uint64_t)root->totalSizeOfSuperPages - (uint64_t)root->totalSizeOfCommittedPages > kReasonableSizeOfUnusedPages) { |
|
Tom Sepez
2014/11/06 17:32:51
why this promotion to unit64_t? Also, are we sure
Chris Evans
2014/11/06 20:43:22
I don't think this condition will ever give more a
Chris Evans
2014/11/06 20:43:22
I also don't like the look of these casts. Hopeful
Jens Widell
2014/11/07 08:31:21
Since we now include direct mapped allocations in
hiroshige
2014/11/07 08:57:00
I expect there are no out-of-virtual-address-space
hiroshige
2014/11/07 08:57:00
Added assertions, and removed casts.
hiroshige
2014/11/07 08:57:00
Yes, and I added totalSizeOfDirectMappedPages in P
|
| + // OOMs where a lot of super pages are allocated but not committed, |
| + // probably due to http://crbug.com/421387. |
| + // Crash at a special address (0x9b) |
| + // to be easily distinguished on crash reports. |
| + ((void(*)())0x0000009b)(); |
|
Tom Sepez
2014/11/06 17:32:51
Maybe we need IMMEDIATE_CRASH_WITH_FLAG(0x9b) macr
Chris Evans
2014/11/06 20:43:22
I don't like this, it's a bit arbitrary and doesn'
hiroshige
2014/11/07 08:56:59
cevans@, Agree, I also prefer what you suggested,
hiroshige
2014/11/07 10:28:17
Added IMMEDIATE_CRASH_WITH_FLAG and partitionOutOf
|
| + } |
| + // Ordinary OOMs (where super pages are consumed and mostly committed). |
| IMMEDIATE_CRASH(); |
| } |
| @@ -701,7 +709,7 @@ void* partitionAllocSlowPath(PartitionRootBase* root, int flags, size_t size, Pa |
| partitionAllocSlowPathFailed: |
| if (returnNull) |
| return nullptr; |
| - partitionOutOfMemory(); |
| + partitionOutOfMemory(root); |
| return nullptr; |
| } |