Chromium Code Reviews| Index: Source/wtf/PartitionAlloc.cpp |
| diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp |
| index d14559485d97aa50051843fc2c46b32762e0f7f5..3cbaeb50a425feb296c32e5e2ff72977355f31e2 100644 |
| --- a/Source/wtf/PartitionAlloc.cpp |
| +++ b/Source/wtf/PartitionAlloc.cpp |
| @@ -30,6 +30,7 @@ |
| #include "config.h" |
| #include "wtf/PartitionAlloc.h" |
| +#include "wtf/Partitions.h" |
|
haraken
2015/09/03 10:53:43
We don't want to add this dependency -- PartitionA
tasak
2015/09/04 05:17:04
Done.
|
| #include <string.h> |
| @@ -299,7 +300,52 @@ static NEVER_INLINE void partitionOutOfMemoryWithLotsOfUncommitedPages() |
| } |
| #endif |
| -static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) |
| +static NEVER_INLINE void parititionOutOfMemoryUsing2G() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing1G() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing512M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing256M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing128M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing64M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing32M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsing16M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static NEVER_INLINE void parititionOutOfMemoryUsingLessThan16M() |
| +{ |
| + IMMEDIATE_CRASH(); |
| +} |
| + |
| +static void partitionOutOfMemory(const PartitionRootBase* root) |
| { |
| #if !CPU(64BIT) |
| // Check whether this OOM is due to a lot of super pages that are allocated |
| @@ -308,7 +354,24 @@ static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) |
| partitionOutOfMemoryWithLotsOfUncommitedPages(); |
| } |
| #endif |
| - IMMEDIATE_CRASH(); |
| + size_t totalUsage = Partitions::totalSizeOfCommittedPages(); |
| + if (totalUsage > 2UL * 1024 * 1024 * 1024) |
| + parititionOutOfMemoryUsing2G(); |
| + if (totalUsage > 1UL * 1024 * 1024 * 1024) |
| + parititionOutOfMemoryUsing1G(); |
| + if (totalUsage > 512 * 1024 * 1024) |
| + parititionOutOfMemoryUsing512M(); |
| + if (totalUsage > 256 * 1024 * 1024) |
| + parititionOutOfMemoryUsing256M(); |
| + if (totalUsage > 128 * 1024 * 1024) |
| + parititionOutOfMemoryUsing128M(); |
| + if (totalUsage > 64 * 1024 * 1024) |
| + parititionOutOfMemoryUsing64M(); |
| + if (totalUsage > 32 * 1024 * 1024) |
| + parititionOutOfMemoryUsing32M(); |
| + if (totalUsage > 16 * 1024 * 1024) |
| + parititionOutOfMemoryUsing16M(); |
| + parititionOutOfMemoryUsingLessThan16M(); |
| } |
| static NEVER_INLINE void partitionExcessiveAllocationSize() |