1 //===-- runtime/memory.cpp ------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "flang/Runtime/memory.h"
10 #include "terminator.h"
13 namespace Fortran::runtime
{
15 void *AllocateMemoryOrCrash(const Terminator
&terminator
, std::size_t bytes
) {
16 if (void *p
{std::malloc(bytes
)}) {
21 "Fortran runtime internal error: out of memory, needed %zd bytes",
27 void FreeMemory(void *p
) { std::free(p
); }
28 } // namespace Fortran::runtime