Index: runtime/vm/benchmark_test.cc |
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc |
index e2f8790357fc229a2466f3a964be18356b71fa99..efe1223e82132d0ba46e666154bae3b4acc910a0 100644 |
--- a/runtime/vm/benchmark_test.cc |
+++ b/runtime/vm/benchmark_test.cc |
@@ -491,6 +491,11 @@ static uint8_t* malloc_allocator(uint8_t* ptr, |
} |
+static void malloc_deallocator(uint8_t* ptr) { |
+ free(ptr); |
+} |
+ |
+ |
BENCHMARK_SIZE(CoreSnapshotSize) { |
const char* kScriptChars = |
"import 'dart:async';\n" |
@@ -607,6 +612,7 @@ static uint8_t* message_allocator(uint8_t* ptr, |
intptr_t new_size) { |
return message_buffer; |
} |
+static void message_deallocator(uint8_t* ptr) {} |
BENCHMARK(SerializeNull) { |
@@ -617,7 +623,8 @@ BENCHMARK(SerializeNull) { |
timer.Start(); |
for (intptr_t i = 0; i < kLoopCount; i++) { |
StackZone zone(thread); |
- MessageWriter writer(&buffer, &message_allocator, true); |
+ MessageWriter writer(&buffer, &message_allocator, &message_deallocator, |
+ true); |
writer.WriteMessage(null_object); |
intptr_t buffer_len = writer.BytesWritten(); |
@@ -639,7 +646,8 @@ BENCHMARK(SerializeSmi) { |
timer.Start(); |
for (intptr_t i = 0; i < kLoopCount; i++) { |
StackZone zone(thread); |
- MessageWriter writer(&buffer, &message_allocator, true); |
+ MessageWriter writer(&buffer, &message_allocator, &message_deallocator, |
+ true); |
writer.WriteMessage(smi_object); |
intptr_t buffer_len = writer.BytesWritten(); |
@@ -664,7 +672,7 @@ BENCHMARK(SimpleMessage) { |
timer.Start(); |
for (intptr_t i = 0; i < kLoopCount; i++) { |
StackZone zone(thread); |
- MessageWriter writer(&buffer, &malloc_allocator, true); |
+ MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true); |
writer.WriteMessage(array_object); |
intptr_t buffer_len = writer.BytesWritten(); |
@@ -698,7 +706,7 @@ BENCHMARK(LargeMap) { |
timer.Start(); |
for (intptr_t i = 0; i < kLoopCount; i++) { |
StackZone zone(thread); |
- MessageWriter writer(&buffer, &malloc_allocator, true); |
+ MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true); |
writer.WriteMessage(map); |
intptr_t buffer_len = writer.BytesWritten(); |