17 FLAG_trace_zones =
true;
27 uintptr_t allocated_size = 0;
31 for (
int i = 0; i < 1000; i++) {
40 const uword kLargeSize = 1 *
MB;
41 const uword kSegmentSize = 64 *
KB;
42 ASSERT(kLargeSize > kSegmentSize);
43 for (
int i = 0; i < 10; i++) {
45 allocated_size += kLargeSize;
55 allocated_size += (kSegmentSize -
kWordSize);
58 buffer =
reinterpret_cast<uint8_t*
>(
62 allocated_size += (kSegmentSize - (2 *
kWordSize));
69 allocated_size += (kSegmentSize +
kWordSize);
78 FLAG_trace_zones =
true;
87 uintptr_t allocated_size = 0;
89 const intptr_t kNumElements = 1000;
91 allocated_size +=
sizeof(uint32_t) * kNumElements;
101 FLAG_trace_zones =
true;
110 const intptr_t kNumElements = (
kIntptrMax /
sizeof(uint32_t)) + 1;
122 auto zone = thread->
zone();
124 const intptr_t kOldLen = 32;
125 const intptr_t kNewLen = 16;
126 const intptr_t kNewLen2 = 16;
128 auto data_old = zone->
Alloc<uint8_t>(kOldLen);
129 auto data_new = zone->Realloc<uint8_t>(data_old, kOldLen, kNewLen);
132 auto data_new2 = zone->Realloc<uint8_t>(data_old, kNewLen, kNewLen2);
140 FLAG_trace_zones =
true;
149 SimpleZoneObject() : slot(
marker++) {}
150 virtual ~SimpleZoneObject() {}
151 virtual int GetSlot() {
return slot; }
163 SimpleZoneObject* first =
new SimpleZoneObject();
165 SimpleZoneObject* second =
new SimpleZoneObject();
166 EXPECT(second !=
nullptr);
168 uintptr_t expected_size = (2 *
sizeof(SimpleZoneObject));
172 EXPECT_EQ(0, first->slot);
173 EXPECT_EQ(1, second->slot);
178 EXPECT_EQ(42, first->slot);
179 EXPECT_EQ(87, second->slot);
189 EXPECT_STREQ(
"Hello World!",
result);
192#if !defined(PRODUCT) && !defined(USING_ADDRESS_SANITIZER) && \
193 !defined(USING_MEMORY_SANITIZER)
219#if defined(CHECK_RSS)
224 for (
size_t i = 0; i < ((3u *
GB) / (512u *
KB)); i++) {
229 free(allocations[j]);
233#if defined(CHECK_RSS)
235 EXPECT_LT(stop_rss, start_rss +
kRssSlack);
240#if defined(CHECK_RSS)
244 for (
size_t i = 0; i < ((3u *
GB) / (512u *
KB)); i++) {
252#if defined(CHECK_RSS)
254 EXPECT_LT(stop_rss, start_rss +
kRssSlack);
258#if defined(DART_COMPRESSED_POINTERS)
261 Zone* zone = stack_zone.GetZone();
264 while (total <= (4u *
GB)) {
265 size_t chunk_size = 512u *
MB;
266 zone->AllocUnsafe(chunk_size);
274 const intptr_t n = 1000000;
281 for (intptr_t i = 0; i < n; i++) {
292 for (intptr_t i = 0; i < n; i++) {
static const char marker[]
#define DEBUG_ASSERT(cond)
#define RELEASE_ASSERT(cond)
static Object & ZoneHandle()
static int64_t CurrentRSS()
uintptr_t SizeInBytes() const
static Dart_Isolate CreateTestIsolate(const char *name=nullptr, void *isolate_group_data=nullptr, void *isolate_data=nullptr)
static Thread * Current()
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
void * AllocUnsafe(intptr_t size)
uintptr_t SizeInBytes() const
ElementType * Alloc(intptr_t length)
static const uint8_t buffer[]
#define HANDLESCOPE(thread)
void * malloc(size_t size)
static constexpr int64_t kRssSlack
constexpr intptr_t kWordSize
static const size_t kSizes[]
DART_EXPORT void Dart_ShutdownIsolate()
constexpr intptr_t kIntptrMax
#define VM_UNIT_TEST_CASE(name)
#define VM_UNIT_TEST_CASE_WITH_EXPECTATION(name, expectation)
#define ISOLATE_UNIT_TEST_CASE(name)
#define ARRAY_SIZE(array)