Files
sdk/runtime/platform/allocation.cc
T
Ryan Macnak b9c86f07dc [vm] Produce clearer error messages for malloc/realloc failures.
TEST=bots
Bug: https://github.com/dart-lang/sdk/issues/43642
Change-Id: I7bc2b3b5231413967f9b1f608c957326ff6c6aaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171680
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-13 22:10:54 +00:00

28 lines
604 B
C++

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/allocation.h"
#include "platform/assert.h"
namespace dart {
void* malloc(size_t size) {
void* result = ::malloc(size);
if (result == nullptr) {
OUT_OF_MEMORY();
}
return result;
}
void* realloc(void* ptr, size_t size) {
void* result = ::realloc(ptr, size);
if (result == nullptr) {
OUT_OF_MEMORY();
}
return result;
}
} // namespace dart