Home | History | Annotate | Download | only in space

Lines Matching refs:space

28 namespace space {
32 void SizeFootPrintGrowthLimitAndTrimBody(DlMallocSpace* space, intptr_t object_size,
36 void AddContinuousSpace(ContinuousSpace* space) {
37 Runtime::Current()->GetHeap()->AddContinuousSpace(space);
49 UniquePtr<Space> space(DlMallocSpace::Create("test", 16 * MB, 32 * MB, 32 * MB, NULL));
50 EXPECT_TRUE(space.get() != NULL);
54 UniquePtr<Space> space(DlMallocSpace::Create("test", 16 * MB, 16 * MB, 16 * MB, NULL));
55 EXPECT_TRUE(space.get() != NULL);
59 UniquePtr<Space> space(DlMallocSpace::Create("test", 32 * MB, 16 * MB, 16 * MB, NULL));
60 EXPECT_TRUE(space.get() == NULL);
64 UniquePtr<Space> space(DlMallocSpace::Create("test", 16 * MB, 16 * MB, 32 * MB, NULL));
65 EXPECT_TRUE(space.get() != NULL);
69 UniquePtr<Space> space(DlMallocSpace::Create("test", 16 * MB, 8 * MB, 32 * MB, NULL));
70 EXPECT_TRUE(space.get() == NULL);
74 UniquePtr<Space> space(DlMallocSpace::Create("test", 8 * MB, 16 * MB, 32 * MB, NULL));
75 EXPECT_TRUE(space.get() != NULL);
79 UniquePtr<Space> space(DlMallocSpace::Create("test", 8 * MB, 32 * MB, 16 * MB, NULL));
80 EXPECT_TRUE(space.get() == NULL);
90 DlMallocSpace* space(DlMallocSpace::Create("test", 4 * MB, 16 * MB, 16 * MB, NULL));
91 ASSERT_TRUE(space != NULL);
93 // Make space findable to the heap, will also delete space when runtime is cleaned up
94 AddContinuousSpace(space);
98 mirror::Object* ptr1 = space->Alloc(self, 1 * MB, &dummy);
102 mirror::Object* ptr2 = space->Alloc(self, 8 * MB, &dummy);
107 mirror::Object* ptr3 = space->AllocWithGrowth(self, 8 * MB, &ptr3_bytes_allocated);
112 mirror::Object* ptr4 = space->Alloc(self, 8 * MB, &dummy);
116 mirror::Object* ptr5 = space->AllocWithGrowth(self, 8 * MB, &dummy);
120 size_t free3 = space->AllocationSize(ptr3);
122 EXPECT_EQ(free3, space->Free(self, ptr3));
126 void* ptr6 = space->AllocWithGrowth(self, 9 * MB, &dummy);
130 size_t free1 = space->AllocationSize(ptr1);
131 space->Free(self, ptr1);
134 // Make sure that the zygote space isn't directly at the start of the space.
135 space->Alloc(self, 1U * MB, &dummy);
136 space = space->CreateZygoteSpace("alloc space");
138 // Make space findable to the heap, will also delete space when runtime is cleaned up
139 AddContinuousSpace(space);
142 ptr1 = space->Alloc(self, 1 * MB, &dummy);
146 ptr2 = space->Alloc(self, 8 * MB, &dummy);
150 ptr3 = space->AllocWithGrowth(self, 2 * MB, &dummy);
152 space->Free(self, ptr3);
155 free1 = space->AllocationSize(ptr1);
156 space->Free(self, ptr1);
162 DlMallocSpace* space(DlMallocSpace::Create("test", 4 * MB, 16 * MB, 16 * MB, NULL));
163 ASSERT_TRUE(space != NULL);
166 // Make space findable to the heap, will also delete space when runtime is cleaned up
167 AddContinuousSpace(space);
170 mirror::Object* ptr1 = space->Alloc(self, 1 * MB, &dummy);
174 mirror::Object* ptr2 = space->Alloc(self, 8 * MB, &dummy);
179 mirror::Object* ptr3 = space->AllocWithGrowth(self, 8 * MB, &ptr3_bytes_allocated);
184 mirror::Object* ptr4 = space->Alloc(self, 8 * MB, &dummy);
188 mirror::Object* ptr5 = space->AllocWithGrowth(self, 8 * MB, &dummy);
192 size_t free3 = space->AllocationSize(ptr3);
194 space->Free(self, ptr3);
198 void* ptr6 = space->AllocWithGrowth(self, 9 * MB, &dummy);
202 size_t free1 = space->AllocationSize(ptr1);
203 space->Free(self, ptr1);
212 los = space::LargeObjectMapSpace::Create("large object space");
214 los = space::FreeListSpace::Create("large object space", NULL, 128 * MB);
269 DlMallocSpace* space(DlMallocSpace::Create("test", 4 * MB, 16 * MB, 16 * MB, NULL));
270 ASSERT_TRUE(space != NULL);
272 // Make space findable to the heap, will also delete space when runtime is cleaned up
273 AddContinuousSpace(space);
280 lots_of_objects[i] = space->Alloc(self, 16, &allocation_size);
281 EXPECT_EQ(allocation_size, space->AllocationSize(lots_of_objects[i]));
286 space->FreeList(self, arraysize(lots_of_objects), lots_of_objects);
294 lots_of_objects[i] = space->AllocWithGrowth(self, 1024, &allocation_size);
295 EXPECT_EQ(allocation_size, space->AllocationSize(lots_of_objects[i]));
300 space->FreeList(self, arraysize(lots_of_objects), lots_of_objects);
306 void SpaceTest::SizeFootPrintGrowthLimitAndTrimBody(DlMallocSpace* space, intptr_t object_size,
314 void* mspace = space->GetMspace();
325 // space's size shouldn't exceed the initial size
326 EXPECT_LE(space->Size(), growth_limit);
329 // space believes its size is (which will break invariants)
330 EXPECT_GE(space->Size(), footprint);
332 // Fill the space with lots of small objects up to the growth limit
336 size_t amount_allocated = 0; // amount of space allocated
355 object = space->Alloc(self, alloc_size, &bytes_allocated);
357 object = space->AllocWithGrowth(self, alloc_size, &bytes_allocated);
360 EXPECT_GE(space->Size(), footprint); // invariant
363 size_t allocation_size = space->AllocationSize(object);
379 CHECK_NE(last_object, 0u); // we should have filled the space
385 EXPECT_LE(space->Size(), growth_limit);
389 EXPECT_GE(space->Size(), amount_allocated);
394 // Give the space a haircut
395 space->Trim();
402 EXPECT_GE(space->Size(), amount_allocated);
403 EXPECT_LE(space->Size(), growth_limit);
415 size_t allocation_size = space->AllocationSize(object);
421 space->Free(self, object);
425 EXPECT_GE(space->Size(), footprint); // invariant
436 large_object = space->Alloc(self, three_quarters_space, &bytes_allocated);
438 large_object = space->AllocWithGrowth(self, three_quarters_space, &bytes_allocated);
445 EXPECT_GE(space->Size(), footprint);
446 EXPECT_LE(space->Size(), growth_limit);
449 space->Free(self, large_object);
454 EXPECT_GE(space->Size(), footprint);
455 EXPECT_LE(space->Size(), growth_limit);
462 DlMallocSpace* space(DlMallocSpace::Create("test", initial_size, growth_limit, capacity, NULL));
463 ASSERT_TRUE(space != NULL);
466 EXPECT_EQ(space
467 EXPECT_EQ(space->NonGrowthLimitCapacity(), capacity);
469 // Make space findable to the heap, will also delete space when runtime is cleaned up
470 AddContinuousSpace(space);
474 SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 1, initial_size);
475 SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 2, growth_limit);
477 space->ClearGrowthLimit();
478 EXPECT_EQ(space->Capacity(), capacity);
479 SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 3, capacity);
505 } // namespace space