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

Side by Side Diff: test/unittests/zone/segmentpool-unittest.cc

Issue 2424393002: Constrain the zone segment pool size (Closed)
Patch Set: Reaction to comments Created 4 years, 2 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 | « test/unittests/unittests.gyp ('k') | 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
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/zone/accounting-allocator.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace v8 {
9 namespace internal {
10
11 TEST(Zone, SegmentPoolConstraints) {
12 size_t sizes[]{
13 0, // Corner case
14 AccountingAllocator::kMaxPoolSizeLowMemoryDevice,
15 AccountingAllocator::kMaxPoolSizeMediumMemoryDevice,
16 AccountingAllocator::kMaxPoolSizeHighMemoryDevice,
17 AccountingAllocator::kMaxPoolSizeHugeMemoryDevice,
18 GB // Something really large
19 };
20
21 AccountingAllocator allocator;
22 for (size_t size : sizes) {
23 allocator.ConfigureSegmentPool(size);
24 size_t total_size = 0;
25 for (size_t power = 0; power < AccountingAllocator::kNumberBuckets;
26 ++power) {
27 total_size +=
28 allocator.unused_segments_max_sizes_[power] * (size_t(1) << power);
29 }
30 EXPECT_LE(total_size, size);
31 }
32 }
33
34 } // namespace internal
35 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/unittests.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698