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

Unified Diff: src/heap.h

Issue 7621014: Fix the thresholds so that the heap does not grow uncontrollably. This fixes (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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 | src/heap.cc » ('j') | src/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
===================================================================
--- src/heap.h (revision 8902)
+++ src/heap.h (working copy)
@@ -1209,9 +1209,28 @@
(PromotedSpaceSize() + PromotedExternalMemorySize());
}
+ static const intptr_t kMinimumPromotionLimit =
+ 2 * (Page::kPageSize > MB ? Page::kPageSize : MB);
+ static const intptr_t kMinimumAllocationLimit =
+ 8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
+ static inline intptr_t PromotionFactor(intptr_t size) {
Vyacheslav Egorov (Chromium) 2011/08/11 15:11:34 More comments about this magical functions would b
Erik Corry 2011/08/11 16:09:08 This function does not exist any more.
+ return size + size / 3;
+ }
+ static inline intptr_t AllocationFactor(intptr_t size) {
+ return size + size / 2;
+ }
+
inline void LowerOldGenLimits(intptr_t bytes) {
- old_gen_promotion_limit_ -= bytes;
- old_gen_allocation_limit_ -= bytes;
+ old_gen_promotion_limit_ =
+ Max(old_gen_promotion_limit_ -
+ PromotionFactor(bytes) * old_gen_limit_factor_,
Vyacheslav Egorov (Chromium) 2011/08/11 15:11:34 multiplying factor by factor. confusing. more comm
Erik Corry 2011/08/11 16:09:08 I was unable to find a better name, but I clarifie
+ (kMinimumAllocationLimit + new_space_.Capacity()) *
+ old_gen_limit_factor_);
+ old_gen_allocation_limit_ =
+ Max(old_gen_allocation_limit_ -
+ AllocationFactor(bytes) * old_gen_limit_factor_,
+ (kMinimumAllocationLimit + new_space_.Capacity()) *
+ old_gen_limit_factor_);
}
// Can be called when the embedding application is idle.
@@ -1458,6 +1477,10 @@
// every allocation in large object space.
intptr_t old_gen_allocation_limit_;
+ // Sometimes the heuristics dictate that those limits are increased. This
+ // variable records that fact.
+ int old_gen_limit_factor_;
+
// Limit on the amount of externally allocated memory allowed
// between global GCs. If reached a global GC is forced.
intptr_t external_allocation_limit_;
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698