space_test.h revision a1ce1fef2d49d1d537776a5308ace7102a815fe5
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_GC_SPACE_SPACE_TEST_H_
18#define ART_RUNTIME_GC_SPACE_SPACE_TEST_H_
19
20#include "zygote_space.h"
21
22#include <stdint.h>
23
24#include "common_runtime_test.h"
25#include "globals.h"
26#include "UniquePtr.h"
27#include "mirror/array-inl.h"
28#include "mirror/object-inl.h"
29
30namespace art {
31namespace gc {
32namespace space {
33
34class SpaceTest : public CommonRuntimeTest {
35 public:
36  void AddSpace(ContinuousSpace* space) {
37    // For RosAlloc, revoke the thread local runs before moving onto a
38    // new alloc space.
39    Runtime::Current()->GetHeap()->RevokeAllThreadLocalBuffers();
40    Runtime::Current()->GetHeap()->AddSpace(space);
41  }
42  void InstallClass(SirtRef<mirror::Object>& o, size_t size)
43      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
44    // Note the minimum size, which is the size of a zero-length byte array.
45    EXPECT_GE(size, SizeOfZeroLengthByteArray());
46    Thread* self = Thread::Current();
47    SirtRef<mirror::ClassLoader> null_loader(self, nullptr);
48    mirror::Class* byte_array_class = Runtime::Current()->GetClassLinker()->FindClass(self, "[B",
49                                                                                      null_loader);
50    EXPECT_TRUE(byte_array_class != nullptr);
51    o->SetClass(byte_array_class);
52    if (kUseBrooksPointer) {
53      o->SetBrooksPointer(o.get());
54    }
55    mirror::Array* arr = o->AsArray<kVerifyNone>();
56    size_t header_size = SizeOfZeroLengthByteArray();
57    int32_t length = size - header_size;
58    arr->SetLength(length);
59    EXPECT_EQ(arr->SizeOf<kVerifyNone>(), size);
60  }
61
62  static size_t SizeOfZeroLengthByteArray() {
63    return mirror::Array::DataOffset(Primitive::ComponentSize(Primitive::kPrimByte)).Uint32Value();
64  }
65
66  typedef MallocSpace* (*CreateSpaceFn)(const std::string& name, size_t initial_size, size_t growth_limit,
67                                        size_t capacity, byte* requested_begin);
68  void InitTestBody(CreateSpaceFn create_space);
69  void ZygoteSpaceTestBody(CreateSpaceFn create_space);
70  void AllocAndFreeTestBody(CreateSpaceFn create_space);
71  void AllocAndFreeListTestBody(CreateSpaceFn create_space);
72
73  void SizeFootPrintGrowthLimitAndTrimBody(MallocSpace* space, intptr_t object_size,
74                                           int round, size_t growth_limit);
75  void SizeFootPrintGrowthLimitAndTrimDriver(size_t object_size, CreateSpaceFn create_space);
76};
77
78static size_t test_rand(size_t* seed) {
79  *seed = *seed * 1103515245 + 12345;
80  return *seed;
81}
82
83void SpaceTest::InitTestBody(CreateSpaceFn create_space) {
84  {
85    // Init < max == growth
86    UniquePtr<Space> space(create_space("test", 16 * MB, 32 * MB, 32 * MB, nullptr));
87    EXPECT_TRUE(space.get() != nullptr);
88  }
89  {
90    // Init == max == growth
91    UniquePtr<Space> space(create_space("test", 16 * MB, 16 * MB, 16 * MB, nullptr));
92    EXPECT_TRUE(space.get() != nullptr);
93  }
94  {
95    // Init > max == growth
96    UniquePtr<Space> space(create_space("test", 32 * MB, 16 * MB, 16 * MB, nullptr));
97    EXPECT_TRUE(space.get() == nullptr);
98  }
99  {
100    // Growth == init < max
101    UniquePtr<Space> space(create_space("test", 16 * MB, 16 * MB, 32 * MB, nullptr));
102    EXPECT_TRUE(space.get() != nullptr);
103  }
104  {
105    // Growth < init < max
106    UniquePtr<Space> space(create_space("test", 16 * MB, 8 * MB, 32 * MB, nullptr));
107    EXPECT_TRUE(space.get() == nullptr);
108  }
109  {
110    // Init < growth < max
111    UniquePtr<Space> space(create_space("test", 8 * MB, 16 * MB, 32 * MB, nullptr));
112    EXPECT_TRUE(space.get() != nullptr);
113  }
114  {
115    // Init < max < growth
116    UniquePtr<Space> space(create_space("test", 8 * MB, 32 * MB, 16 * MB, nullptr));
117    EXPECT_TRUE(space.get() == nullptr);
118  }
119}
120
121// TODO: This test is not very good, we should improve it.
122// The test should do more allocations before the creation of the ZygoteSpace, and then do
123// allocations after the ZygoteSpace is created. The test should also do some GCs to ensure that
124// the GC works with the ZygoteSpace.
125void SpaceTest::ZygoteSpaceTestBody(CreateSpaceFn create_space) {
126  size_t dummy = 0;
127  MallocSpace* space(create_space("test", 4 * MB, 16 * MB, 16 * MB, nullptr));
128  ASSERT_TRUE(space != nullptr);
129
130  // Make space findable to the heap, will also delete space when runtime is cleaned up
131  AddSpace(space);
132  Thread* self = Thread::Current();
133  ScopedObjectAccess soa(self);
134
135  // Succeeds, fits without adjusting the footprint limit.
136  SirtRef<mirror::Object> ptr1(self, space->Alloc(self, 1 * MB, &dummy));
137  EXPECT_TRUE(ptr1.get() != nullptr);
138  InstallClass(ptr1, 1 * MB);
139
140  // Fails, requires a higher footprint limit.
141  mirror::Object* ptr2 = space->Alloc(self, 8 * MB, &dummy);
142  EXPECT_TRUE(ptr2 == nullptr);
143
144  // Succeeds, adjusts the footprint.
145  size_t ptr3_bytes_allocated;
146  SirtRef<mirror::Object> ptr3(self, space->AllocWithGrowth(self, 8 * MB, &ptr3_bytes_allocated));
147  EXPECT_TRUE(ptr3.get() != nullptr);
148  EXPECT_LE(8U * MB, ptr3_bytes_allocated);
149  InstallClass(ptr3, 8 * MB);
150
151  // Fails, requires a higher footprint limit.
152  mirror::Object* ptr4 = space->Alloc(self, 8 * MB, &dummy);
153  EXPECT_TRUE(ptr4 == nullptr);
154
155  // Also fails, requires a higher allowed footprint.
156  mirror::Object* ptr5 = space->AllocWithGrowth(self, 8 * MB, &dummy);
157  EXPECT_TRUE(ptr5 == nullptr);
158
159  // Release some memory.
160  size_t free3 = space->AllocationSize(ptr3.get());
161  EXPECT_EQ(free3, ptr3_bytes_allocated);
162  EXPECT_EQ(free3, space->Free(self, ptr3.reset(nullptr)));
163  EXPECT_LE(8U * MB, free3);
164
165  // Succeeds, now that memory has been freed.
166  SirtRef<mirror::Object> ptr6(self, space->AllocWithGrowth(self, 9 * MB, &dummy));
167  EXPECT_TRUE(ptr6.get() != nullptr);
168  InstallClass(ptr6, 9 * MB);
169
170  // Final clean up.
171  size_t free1 = space->AllocationSize(ptr1.get());
172  space->Free(self, ptr1.reset(nullptr));
173  EXPECT_LE(1U * MB, free1);
174
175  // Make sure that the zygote space isn't directly at the start of the space.
176  space->Alloc(self, 1U * MB, &dummy);
177
178  gc::Heap* heap = Runtime::Current()->GetHeap();
179  space::Space* old_space = space;
180  heap->RemoveSpace(old_space);
181  space::ZygoteSpace* zygote_space = space->CreateZygoteSpace("alloc space",
182                                                              heap->IsLowMemoryMode(),
183                                                              &space);
184  delete old_space;
185  // Add the zygote space.
186  AddSpace(zygote_space);
187
188  // Make space findable to the heap, will also delete space when runtime is cleaned up
189  AddSpace(space);
190
191  // Succeeds, fits without adjusting the footprint limit.
192  ptr1.reset(space->Alloc(self, 1 * MB, &dummy));
193  EXPECT_TRUE(ptr1.get() != nullptr);
194  InstallClass(ptr1, 1 * MB);
195
196  // Fails, requires a higher footprint limit.
197  ptr2 = space->Alloc(self, 8 * MB, &dummy);
198  EXPECT_TRUE(ptr2 == nullptr);
199
200  // Succeeds, adjusts the footprint.
201  ptr3.reset(space->AllocWithGrowth(self, 2 * MB, &dummy));
202  EXPECT_TRUE(ptr3.get() != nullptr);
203  InstallClass(ptr3, 2 * MB);
204  space->Free(self, ptr3.reset(nullptr));
205
206  // Final clean up.
207  free1 = space->AllocationSize(ptr1.get());
208  space->Free(self, ptr1.reset(nullptr));
209  EXPECT_LE(1U * MB, free1);
210}
211
212void SpaceTest::AllocAndFreeTestBody(CreateSpaceFn create_space) {
213  size_t dummy = 0;
214  MallocSpace* space(create_space("test", 4 * MB, 16 * MB, 16 * MB, nullptr));
215  ASSERT_TRUE(space != nullptr);
216  Thread* self = Thread::Current();
217  ScopedObjectAccess soa(self);
218
219  // Make space findable to the heap, will also delete space when runtime is cleaned up
220  AddSpace(space);
221
222  // Succeeds, fits without adjusting the footprint limit.
223  SirtRef<mirror::Object> ptr1(self, space->Alloc(self, 1 * MB, &dummy));
224  EXPECT_TRUE(ptr1.get() != nullptr);
225  InstallClass(ptr1, 1 * MB);
226
227  // Fails, requires a higher footprint limit.
228  mirror::Object* ptr2 = space->Alloc(self, 8 * MB, &dummy);
229  EXPECT_TRUE(ptr2 == nullptr);
230
231  // Succeeds, adjusts the footprint.
232  size_t ptr3_bytes_allocated;
233  SirtRef<mirror::Object> ptr3(self, space->AllocWithGrowth(self, 8 * MB, &ptr3_bytes_allocated));
234  EXPECT_TRUE(ptr3.get() != nullptr);
235  EXPECT_LE(8U * MB, ptr3_bytes_allocated);
236  InstallClass(ptr3, 8 * MB);
237
238  // Fails, requires a higher footprint limit.
239  mirror::Object* ptr4 = space->Alloc(self, 8 * MB, &dummy);
240  EXPECT_TRUE(ptr4 == nullptr);
241
242  // Also fails, requires a higher allowed footprint.
243  mirror::Object* ptr5 = space->AllocWithGrowth(self, 8 * MB, &dummy);
244  EXPECT_TRUE(ptr5 == nullptr);
245
246  // Release some memory.
247  size_t free3 = space->AllocationSize(ptr3.get());
248  EXPECT_EQ(free3, ptr3_bytes_allocated);
249  space->Free(self, ptr3.reset(nullptr));
250  EXPECT_LE(8U * MB, free3);
251
252  // Succeeds, now that memory has been freed.
253  SirtRef<mirror::Object> ptr6(self, space->AllocWithGrowth(self, 9 * MB, &dummy));
254  EXPECT_TRUE(ptr6.get() != nullptr);
255  InstallClass(ptr6, 9 * MB);
256
257  // Final clean up.
258  size_t free1 = space->AllocationSize(ptr1.get());
259  space->Free(self, ptr1.reset(nullptr));
260  EXPECT_LE(1U * MB, free1);
261}
262
263void SpaceTest::AllocAndFreeListTestBody(CreateSpaceFn create_space) {
264  MallocSpace* space(create_space("test", 4 * MB, 16 * MB, 16 * MB, nullptr));
265  ASSERT_TRUE(space != nullptr);
266
267  // Make space findable to the heap, will also delete space when runtime is cleaned up
268  AddSpace(space);
269  Thread* self = Thread::Current();
270  ScopedObjectAccess soa(self);
271
272  // Succeeds, fits without adjusting the max allowed footprint.
273  mirror::Object* lots_of_objects[1024];
274  for (size_t i = 0; i < arraysize(lots_of_objects); i++) {
275    size_t allocation_size = 0;
276    size_t size_of_zero_length_byte_array = SizeOfZeroLengthByteArray();
277    lots_of_objects[i] = space->Alloc(self, size_of_zero_length_byte_array, &allocation_size);
278    EXPECT_TRUE(lots_of_objects[i] != nullptr);
279    SirtRef<mirror::Object> obj(self, lots_of_objects[i]);
280    InstallClass(obj, size_of_zero_length_byte_array);
281    lots_of_objects[i] = obj.get();
282    EXPECT_EQ(allocation_size, space->AllocationSize(lots_of_objects[i]));
283  }
284
285  // Release memory and check pointers are nullptr.
286  space->FreeList(self, arraysize(lots_of_objects), lots_of_objects);
287  for (size_t i = 0; i < arraysize(lots_of_objects); i++) {
288    EXPECT_TRUE(lots_of_objects[i] == nullptr);
289  }
290
291  // Succeeds, fits by adjusting the max allowed footprint.
292  for (size_t i = 0; i < arraysize(lots_of_objects); i++) {
293    size_t allocation_size = 0;
294    lots_of_objects[i] = space->AllocWithGrowth(self, 1024, &allocation_size);
295    EXPECT_TRUE(lots_of_objects[i] != nullptr);
296    SirtRef<mirror::Object> obj(self, lots_of_objects[i]);
297    InstallClass(obj, 1024);
298    lots_of_objects[i] = obj.get();
299    EXPECT_EQ(allocation_size, space->AllocationSize(lots_of_objects[i]));
300  }
301
302  // Release memory and check pointers are nullptr
303  // TODO: This isn't compaction safe, fix.
304  space->FreeList(self, arraysize(lots_of_objects), lots_of_objects);
305  for (size_t i = 0; i < arraysize(lots_of_objects); i++) {
306    EXPECT_TRUE(lots_of_objects[i] == nullptr);
307  }
308}
309
310void SpaceTest::SizeFootPrintGrowthLimitAndTrimBody(MallocSpace* space, intptr_t object_size,
311                                                    int round, size_t growth_limit) {
312  if (((object_size > 0 && object_size >= static_cast<intptr_t>(growth_limit))) ||
313      ((object_size < 0 && -object_size >= static_cast<intptr_t>(growth_limit)))) {
314    // No allocation can succeed
315    return;
316  }
317
318  // The space's footprint equals amount of resources requested from system
319  size_t footprint = space->GetFootprint();
320
321  // The space must at least have its book keeping allocated
322  EXPECT_GT(footprint, 0u);
323
324  // But it shouldn't exceed the initial size
325  EXPECT_LE(footprint, growth_limit);
326
327  // space's size shouldn't exceed the initial size
328  EXPECT_LE(space->Size(), growth_limit);
329
330  // this invariant should always hold or else the space has grown to be larger than what the
331  // space believes its size is (which will break invariants)
332  EXPECT_GE(space->Size(), footprint);
333
334  // Fill the space with lots of small objects up to the growth limit
335  size_t max_objects = (growth_limit / (object_size > 0 ? object_size : 8)) + 1;
336  UniquePtr<mirror::Object*[]> lots_of_objects(new mirror::Object*[max_objects]);
337  size_t last_object = 0;  // last object for which allocation succeeded
338  size_t amount_allocated = 0;  // amount of space allocated
339  Thread* self = Thread::Current();
340  ScopedObjectAccess soa(self);
341  size_t rand_seed = 123456789;
342  for (size_t i = 0; i < max_objects; i++) {
343    size_t alloc_fails = 0;  // number of failed allocations
344    size_t max_fails = 30;  // number of times we fail allocation before giving up
345    for (; alloc_fails < max_fails; alloc_fails++) {
346      size_t alloc_size;
347      if (object_size > 0) {
348        alloc_size = object_size;
349      } else {
350        alloc_size = test_rand(&rand_seed) % static_cast<size_t>(-object_size);
351        // Note the minimum size, which is the size of a zero-length byte array.
352        size_t size_of_zero_length_byte_array = SizeOfZeroLengthByteArray();
353        if (alloc_size < size_of_zero_length_byte_array) {
354          alloc_size = size_of_zero_length_byte_array;
355        }
356      }
357      SirtRef<mirror::Object> object(self, nullptr);
358      size_t bytes_allocated = 0;
359      if (round <= 1) {
360        object.reset(space->Alloc(self, alloc_size, &bytes_allocated));
361      } else {
362        object.reset(space->AllocWithGrowth(self, alloc_size, &bytes_allocated));
363      }
364      footprint = space->GetFootprint();
365      EXPECT_GE(space->Size(), footprint);  // invariant
366      if (object.get() != nullptr) {  // allocation succeeded
367        InstallClass(object, alloc_size);
368        lots_of_objects[i] = object.get();
369        size_t allocation_size = space->AllocationSize(object.get());
370        EXPECT_EQ(bytes_allocated, allocation_size);
371        if (object_size > 0) {
372          EXPECT_GE(allocation_size, static_cast<size_t>(object_size));
373        } else {
374          EXPECT_GE(allocation_size, 8u);
375        }
376        amount_allocated += allocation_size;
377        break;
378      }
379    }
380    if (alloc_fails == max_fails) {
381      last_object = i;
382      break;
383    }
384  }
385  CHECK_NE(last_object, 0u);  // we should have filled the space
386  EXPECT_GT(amount_allocated, 0u);
387
388  // We shouldn't have gone past the growth_limit
389  EXPECT_LE(amount_allocated, growth_limit);
390  EXPECT_LE(footprint, growth_limit);
391  EXPECT_LE(space->Size(), growth_limit);
392
393  // footprint and size should agree with amount allocated
394  EXPECT_GE(footprint, amount_allocated);
395  EXPECT_GE(space->Size(), amount_allocated);
396
397  // Release storage in a semi-adhoc manner
398  size_t free_increment = 96;
399  while (true) {
400    {
401      ScopedThreadStateChange tsc(self, kNative);
402      // Give the space a haircut.
403      space->Trim();
404    }
405
406    // Bounds sanity
407    footprint = space->GetFootprint();
408    EXPECT_LE(amount_allocated, growth_limit);
409    EXPECT_GE(footprint, amount_allocated);
410    EXPECT_LE(footprint, growth_limit);
411    EXPECT_GE(space->Size(), amount_allocated);
412    EXPECT_LE(space->Size(), growth_limit);
413
414    if (free_increment == 0) {
415      break;
416    }
417
418    // Free some objects
419    for (size_t i = 0; i < last_object; i += free_increment) {
420      mirror::Object* object = lots_of_objects.get()[i];
421      if (object == nullptr) {
422        continue;
423      }
424      size_t allocation_size = space->AllocationSize(object);
425      if (object_size > 0) {
426        EXPECT_GE(allocation_size, static_cast<size_t>(object_size));
427      } else {
428        EXPECT_GE(allocation_size, 8u);
429      }
430      space->Free(self, object);
431      lots_of_objects.get()[i] = nullptr;
432      amount_allocated -= allocation_size;
433      footprint = space->GetFootprint();
434      EXPECT_GE(space->Size(), footprint);  // invariant
435    }
436
437    free_increment >>= 1;
438  }
439
440  // The space has become empty here before allocating a large object
441  // below. For RosAlloc, revoke thread-local runs, which are kept
442  // even when empty for a performance reason, so that they won't
443  // cause the following large object allocation to fail due to
444  // potential fragmentation. Note they are normally revoked at each
445  // GC (but no GC here.)
446  space->RevokeAllThreadLocalBuffers();
447
448  // All memory was released, try a large allocation to check freed memory is being coalesced
449  SirtRef<mirror::Object> large_object(self, nullptr);
450  size_t three_quarters_space = (growth_limit / 2) + (growth_limit / 4);
451  size_t bytes_allocated = 0;
452  if (round <= 1) {
453    large_object.reset(space->Alloc(self, three_quarters_space, &bytes_allocated));
454  } else {
455    large_object.reset(space->AllocWithGrowth(self, three_quarters_space, &bytes_allocated));
456  }
457  EXPECT_TRUE(large_object.get() != nullptr);
458  InstallClass(large_object, three_quarters_space);
459
460  // Sanity check footprint
461  footprint = space->GetFootprint();
462  EXPECT_LE(footprint, growth_limit);
463  EXPECT_GE(space->Size(), footprint);
464  EXPECT_LE(space->Size(), growth_limit);
465
466  // Clean up
467  space->Free(self, large_object.reset(nullptr));
468
469  // Sanity check footprint
470  footprint = space->GetFootprint();
471  EXPECT_LE(footprint, growth_limit);
472  EXPECT_GE(space->Size(), footprint);
473  EXPECT_LE(space->Size(), growth_limit);
474}
475
476void SpaceTest::SizeFootPrintGrowthLimitAndTrimDriver(size_t object_size, CreateSpaceFn create_space) {
477  if (object_size < SizeOfZeroLengthByteArray()) {
478    // Too small for the object layout/model.
479    return;
480  }
481  size_t initial_size = 4 * MB;
482  size_t growth_limit = 8 * MB;
483  size_t capacity = 16 * MB;
484  MallocSpace* space(create_space("test", initial_size, growth_limit, capacity, nullptr));
485  ASSERT_TRUE(space != nullptr);
486
487  // Basic sanity
488  EXPECT_EQ(space->Capacity(), growth_limit);
489  EXPECT_EQ(space->NonGrowthLimitCapacity(), capacity);
490
491  // Make space findable to the heap, will also delete space when runtime is cleaned up
492  AddSpace(space);
493
494  // In this round we don't allocate with growth and therefore can't grow past the initial size.
495  // This effectively makes the growth_limit the initial_size, so assert this.
496  SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 1, initial_size);
497  SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 2, growth_limit);
498  // Remove growth limit
499  space->ClearGrowthLimit();
500  EXPECT_EQ(space->Capacity(), capacity);
501  SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 3, capacity);
502}
503
504#define TEST_SizeFootPrintGrowthLimitAndTrim(name, spaceName, spaceFn, size) \
505  TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_AllocationsOf_##name) { \
506    SizeFootPrintGrowthLimitAndTrimDriver(size, spaceFn); \
507  } \
508  TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_RandomAllocationsWithMax_##name) { \
509    SizeFootPrintGrowthLimitAndTrimDriver(-size, spaceFn); \
510  }
511
512#define TEST_SPACE_CREATE_FN(spaceName, spaceFn) \
513  class spaceName##Test : public SpaceTest { \
514  }; \
515  \
516  TEST_F(spaceName##Test, Init) { \
517    InitTestBody(spaceFn); \
518  } \
519  TEST_F(spaceName##Test, ZygoteSpace) { \
520    ZygoteSpaceTestBody(spaceFn); \
521  } \
522  TEST_F(spaceName##Test, AllocAndFree) { \
523    AllocAndFreeTestBody(spaceFn); \
524  } \
525  TEST_F(spaceName##Test, AllocAndFreeList) { \
526    AllocAndFreeListTestBody(spaceFn); \
527  } \
528  TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_AllocationsOf_12B) { \
529    SizeFootPrintGrowthLimitAndTrimDriver(12, spaceFn); \
530  } \
531  TEST_SizeFootPrintGrowthLimitAndTrim(16B, spaceName, spaceFn, 16) \
532  TEST_SizeFootPrintGrowthLimitAndTrim(24B, spaceName, spaceFn, 24) \
533  TEST_SizeFootPrintGrowthLimitAndTrim(32B, spaceName, spaceFn, 32) \
534  TEST_SizeFootPrintGrowthLimitAndTrim(64B, spaceName, spaceFn, 64) \
535  TEST_SizeFootPrintGrowthLimitAndTrim(128B, spaceName, spaceFn, 128) \
536  TEST_SizeFootPrintGrowthLimitAndTrim(1KB, spaceName, spaceFn, 1 * KB) \
537  TEST_SizeFootPrintGrowthLimitAndTrim(4KB, spaceName, spaceFn, 4 * KB) \
538  TEST_SizeFootPrintGrowthLimitAndTrim(1MB, spaceName, spaceFn, 1 * MB) \
539  TEST_SizeFootPrintGrowthLimitAndTrim(4MB, spaceName, spaceFn, 4 * MB) \
540  TEST_SizeFootPrintGrowthLimitAndTrim(8MB, spaceName, spaceFn, 8 * MB)
541
542}  // namespace space
543}  // namespace gc
544}  // namespace art
545
546#endif  // ART_RUNTIME_GC_SPACE_SPACE_TEST_H_
547