| OLD | NEW |
| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 return judgeGCThreshold(1024 * 1024, 1.5); | 568 return judgeGCThreshold(1024 * 1024, 1.5); |
| 569 } | 569 } |
| 570 | 570 |
| 571 bool ThreadState::shouldScheduleV8FollowupGC() | 571 bool ThreadState::shouldScheduleV8FollowupGC() |
| 572 { | 572 { |
| 573 return judgeGCThreshold(32 * 1024 * 1024, 1.5); | 573 return judgeGCThreshold(32 * 1024 * 1024, 1.5); |
| 574 } | 574 } |
| 575 | 575 |
| 576 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) | 576 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) |
| 577 { | 577 { |
| 578 return judgeGCThreshold(1024 * 1024, 1.5 * (1 - estimatedRemovalRatio)); | 578 // If estimatedRemovalRatio is low we should let IdleGC handle this. |
| 579 if (estimatedRemovalRatio < 0.01) |
| 580 return false; |
| 581 return judgeGCThreshold(32 * 1024 * 1024, 1.5 * (1 - estimatedRemovalRatio))
; |
| 579 } | 582 } |
| 580 | 583 |
| 581 bool ThreadState::shouldForceConservativeGC() | 584 bool ThreadState::shouldForceConservativeGC() |
| 582 { | 585 { |
| 583 // TODO(haraken): 400% is too large. Lower the heap growing factor. | 586 // TODO(haraken): 400% is too large. Lower the heap growing factor. |
| 584 return judgeGCThreshold(32 * 1024 * 1024, 5.0); | 587 return judgeGCThreshold(32 * 1024 * 1024, 5.0); |
| 585 } | 588 } |
| 586 | 589 |
| 587 // If we're consuming too much memory, trigger a conservative GC | 590 // If we're consuming too much memory, trigger a conservative GC |
| 588 // aggressively. This is a safe guard to avoid OOM. | 591 // aggressively. This is a safe guard to avoid OOM. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 dataLogF("Scheduled MemoryPressureGC\n"); | 668 dataLogF("Scheduled MemoryPressureGC\n"); |
| 666 #endif | 669 #endif |
| 667 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithoutSwe
ep, BlinkGC::MemoryPressureGC); | 670 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithoutSwe
ep, BlinkGC::MemoryPressureGC); |
| 668 return; | 671 return; |
| 669 } | 672 } |
| 670 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) { | 673 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) { |
| 671 #if PRINT_HEAP_STATS | 674 #if PRINT_HEAP_STATS |
| 672 dataLogF("Scheduled PageNavigationGC\n"); | 675 dataLogF("Scheduled PageNavigationGC\n"); |
| 673 #endif | 676 #endif |
| 674 schedulePageNavigationGC(); | 677 schedulePageNavigationGC(); |
| 675 return; | |
| 676 } | 678 } |
| 677 } | 679 } |
| 678 | 680 |
| 679 void ThreadState::schedulePageNavigationGC() | 681 void ThreadState::schedulePageNavigationGC() |
| 680 { | 682 { |
| 681 ASSERT(checkThread()); | 683 ASSERT(checkThread()); |
| 682 ASSERT(!isSweepingInProgress()); | 684 ASSERT(!isSweepingInProgress()); |
| 683 setGCState(PageNavigationGCScheduled); | 685 setGCState(PageNavigationGCScheduled); |
| 684 } | 686 } |
| 685 | 687 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1539 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1538 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1540 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1539 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1541 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1540 | 1542 |
| 1541 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1543 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1542 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1544 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1543 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1545 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1544 } | 1546 } |
| 1545 | 1547 |
| 1546 } // namespace blink | 1548 } // namespace blink |
| OLD | NEW |