未验证 提交 244d7a2c 编写于 作者: S Stanislav Baranov 提交者: GitHub

Fix compilation trace memory management problem

This fixes issue with compilation trace buffer getting released upon return from VM code to Dart code, before it gets change to save to a file in natives.dart saveCompilationTrace().
上级 00a5b808
......@@ -214,12 +214,23 @@ void SaveCompilationTrace(Dart_NativeArguments args) {
return;
}
result = Dart_NewExternalTypedData(Dart_TypedData_kUint8, buffer, length);
result = Dart_NewTypedData(Dart_TypedData_kUint8, length);
if (Dart_IsError(result)) {
Dart_SetReturnValue(args, result);
return;
}
Dart_TypedData_Type type;
void* data = nullptr;
intptr_t size = 0;
Dart_Handle status = Dart_TypedDataAcquireData(result, &type, &data, &size);
if (Dart_IsError(status)) {
Dart_SetReturnValue(args, status);
return;
}
memcpy(data, buffer, length);
Dart_TypedDataReleaseData(result);
Dart_SetReturnValue(args, result);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册