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

Side by Side Diff: Source/wtf/PartitionAlloc.cpp

Issue 1315113006: Add partitionsOutOfMemoryUsingXXX to know Blink memory usage from OOM crash reports (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "wtf/PartitionAlloc.h" 32 #include "wtf/PartitionAlloc.h"
33 #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.
33 34
34 #include <string.h> 35 #include <string.h>
35 36
36 #ifndef NDEBUG 37 #ifndef NDEBUG
37 #include <stdio.h> 38 #include <stdio.h>
38 #endif 39 #endif
39 40
40 // Two partition pages are used as guard / metadata page so make sure the super 41 // Two partition pages are used as guard / metadata page so make sure the super
41 // page size is bigger. 42 // page size is bigger.
42 static_assert(WTF::kPartitionPageSize * 4 <= WTF::kSuperPageSize, "ok super page size"); 43 static_assert(WTF::kPartitionPageSize * 4 <= WTF::kSuperPageSize, "ok super page size");
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return !foundLeak; 293 return !foundLeak;
293 } 294 }
294 295
295 #if !CPU(64BIT) 296 #if !CPU(64BIT)
296 static NEVER_INLINE void partitionOutOfMemoryWithLotsOfUncommitedPages() 297 static NEVER_INLINE void partitionOutOfMemoryWithLotsOfUncommitedPages()
297 { 298 {
298 IMMEDIATE_CRASH(); 299 IMMEDIATE_CRASH();
299 } 300 }
300 #endif 301 #endif
301 302
302 static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root) 303 static NEVER_INLINE void parititionOutOfMemoryUsing2G()
304 {
305 IMMEDIATE_CRASH();
306 }
307
308 static NEVER_INLINE void parititionOutOfMemoryUsing1G()
309 {
310 IMMEDIATE_CRASH();
311 }
312
313 static NEVER_INLINE void parititionOutOfMemoryUsing512M()
314 {
315 IMMEDIATE_CRASH();
316 }
317
318 static NEVER_INLINE void parititionOutOfMemoryUsing256M()
319 {
320 IMMEDIATE_CRASH();
321 }
322
323 static NEVER_INLINE void parititionOutOfMemoryUsing128M()
324 {
325 IMMEDIATE_CRASH();
326 }
327
328 static NEVER_INLINE void parititionOutOfMemoryUsing64M()
329 {
330 IMMEDIATE_CRASH();
331 }
332
333 static NEVER_INLINE void parititionOutOfMemoryUsing32M()
334 {
335 IMMEDIATE_CRASH();
336 }
337
338 static NEVER_INLINE void parititionOutOfMemoryUsing16M()
339 {
340 IMMEDIATE_CRASH();
341 }
342
343 static NEVER_INLINE void parititionOutOfMemoryUsingLessThan16M()
344 {
345 IMMEDIATE_CRASH();
346 }
347
348 static void partitionOutOfMemory(const PartitionRootBase* root)
303 { 349 {
304 #if !CPU(64BIT) 350 #if !CPU(64BIT)
305 // Check whether this OOM is due to a lot of super pages that are allocated 351 // Check whether this OOM is due to a lot of super pages that are allocated
306 // but not committed, probably due to http://crbug.com/421387. 352 // but not committed, probably due to http://crbug.com/421387.
307 if (root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages - root- >totalSizeOfCommittedPages > kReasonableSizeOfUnusedPages) { 353 if (root->totalSizeOfSuperPages + root->totalSizeOfDirectMappedPages - root- >totalSizeOfCommittedPages > kReasonableSizeOfUnusedPages) {
308 partitionOutOfMemoryWithLotsOfUncommitedPages(); 354 partitionOutOfMemoryWithLotsOfUncommitedPages();
309 } 355 }
310 #endif 356 #endif
311 IMMEDIATE_CRASH(); 357 size_t totalUsage = Partitions::totalSizeOfCommittedPages();
358 if (totalUsage > 2UL * 1024 * 1024 * 1024)
359 parititionOutOfMemoryUsing2G();
360 if (totalUsage > 1UL * 1024 * 1024 * 1024)
361 parititionOutOfMemoryUsing1G();
362 if (totalUsage > 512 * 1024 * 1024)
363 parititionOutOfMemoryUsing512M();
364 if (totalUsage > 256 * 1024 * 1024)
365 parititionOutOfMemoryUsing256M();
366 if (totalUsage > 128 * 1024 * 1024)
367 parititionOutOfMemoryUsing128M();
368 if (totalUsage > 64 * 1024 * 1024)
369 parititionOutOfMemoryUsing64M();
370 if (totalUsage > 32 * 1024 * 1024)
371 parititionOutOfMemoryUsing32M();
372 if (totalUsage > 16 * 1024 * 1024)
373 parititionOutOfMemoryUsing16M();
374 parititionOutOfMemoryUsingLessThan16M();
312 } 375 }
313 376
314 static NEVER_INLINE void partitionExcessiveAllocationSize() 377 static NEVER_INLINE void partitionExcessiveAllocationSize()
315 { 378 {
316 IMMEDIATE_CRASH(); 379 IMMEDIATE_CRASH();
317 } 380 }
318 381
319 static NEVER_INLINE void partitionBucketFull() 382 static NEVER_INLINE void partitionBucketFull()
320 { 383 {
321 IMMEDIATE_CRASH(); 384 IMMEDIATE_CRASH();
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 partitionStats.totalDiscardableBytes += memoryStats[i].discardableBy tes; 1459 partitionStats.totalDiscardableBytes += memoryStats[i].discardableBy tes;
1397 if (!isLightDump) 1460 if (!isLightDump)
1398 partitionStatsDumper->partitionsDumpBucketStats(partitionName, & memoryStats[i]); 1461 partitionStatsDumper->partitionsDumpBucketStats(partitionName, & memoryStats[i]);
1399 } 1462 }
1400 } 1463 }
1401 partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats); 1464 partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats);
1402 } 1465 }
1403 1466
1404 } // namespace WTF 1467 } // namespace WTF
1405 1468
OLDNEW
« 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