This fixes memory regression caused by not reducing new-space size.
BUG=chromium:517468
LOG=NO
Review URL: https://codereview.chromium.org/
1273083002
Cr-Commit-Position: refs/heads/master@{#30049}
}
+size_t GCTracer::CurrentAllocationThroughputInBytesPerMillisecond() const {
+ return AllocationThroughputInBytesPerMillisecond(kThroughputTimeFrameMs);
+}
+
+
size_t GCTracer::CurrentOldGenerationAllocationThroughputInBytesPerMillisecond()
const {
- static const double kThroughputTimeFrame = 5000;
return OldGenerationAllocationThroughputInBytesPerMillisecond(
- kThroughputTimeFrame);
+ kThroughputTimeFrameMs);
}
typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer;
+ static const int kThroughputTimeFrameMs = 5000;
+
explicit GCTracer(Heap* heap);
// Start collecting data.
// Returns 0 if no allocation events have been recorded.
size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const;
+ // Allocation throughput in heap in bytes/milliseconds in
+ // the last five seconds.
+ // Returns 0 if no allocation events have been recorded.
+ size_t CurrentAllocationThroughputInBytesPerMillisecond() const;
+
// Allocation throughput in old generation in bytes/milliseconds in
// the last five seconds.
// Returns 0 if no allocation events have been recorded.
void Heap::ReduceNewSpaceSize() {
- if (!FLAG_predictable && HasLowAllocationRate()) {
+ // TODO(ulan): Unify this constant with the similar constant in
+ // GCIdleTimeHandler once the change is merged to 4.5.
+ static const size_t kLowAllocationThroughput = 1000;
+ size_t allocation_throughput =
+ tracer()->CurrentAllocationThroughputInBytesPerMillisecond();
+ if (FLAG_predictable || allocation_throughput == 0) return;
+ if (allocation_throughput < kLowAllocationThroughput) {
new_space_.Shrink();
UncommitFromSpace();
}