Fix a error in SamplingCircularQueue found using Valgrind memcheck.

Review URL: http://codereview.chromium.org/3251004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5373 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 19dc35c1
...@@ -47,8 +47,9 @@ SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes, ...@@ -47,8 +47,9 @@ SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes,
producer_consumer_distance_(2 * chunk_size_), producer_consumer_distance_(2 * chunk_size_),
buffer_(NewArray<Cell>(buffer_size_ + 1)) { buffer_(NewArray<Cell>(buffer_size_ + 1)) {
ASSERT(buffer_size_in_chunks > 2); ASSERT(buffer_size_in_chunks > 2);
// Only need to keep the first cell of a chunk clean. // Clean up the whole buffer to avoid encountering a random kEnd
for (int i = 0; i < buffer_size_; i += chunk_size_) { // while enqueuing.
for (int i = 0; i < buffer_size_; ++i) {
buffer_[i] = kClear; buffer_[i] = kClear;
} }
buffer_[buffer_size_] = kEnd; buffer_[buffer_size_] = kEnd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment