Index: runtime/lib/vmservice.cc |
diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc |
index 5b6af4f707ce598da661873e44ac8f1b94610d15..9d83c13b9d8e421a7bb7b734f77843d561c7e655 100644 |
--- a/runtime/lib/vmservice.cc |
+++ b/runtime/lib/vmservice.cc |
@@ -21,11 +21,17 @@ namespace dart { |
DECLARE_FLAG(bool, trace_service); |
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
+static uint8_t* malloc_allocator(uint8_t* ptr, |
+ intptr_t old_size, |
+ intptr_t new_size) { |
void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
return reinterpret_cast<uint8_t*>(new_ptr); |
} |
+static void malloc_deallocator(uint8_t* ptr) { |
+ free(reinterpret_cast<void*>(ptr)); |
+} |
+ |
#ifndef PRODUCT |
class RegisterRunningIsolatesVisitor : public IsolateVisitor { |
@@ -95,7 +101,7 @@ DEFINE_NATIVE_ENTRY(VMService_SendIsolateServiceMessage, 2) { |
// Serialize message. |
uint8_t* data = NULL; |
- MessageWriter writer(&data, &allocator, false); |
+ MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false); |
writer.WriteMessage(message); |
// TODO(turnidge): Throw an exception when the return value is false? |