µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
memory-resource.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2016-2025 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software
6 * for any purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can
9 * be obtained from https://opensource.org/licenses/mit.
10 */
11
12/*
13 * [Partly inspired from the LLVM libcxx sources].
14 * Copyright (c) 2009-2013 by the contributors listed in
15 * 'LLVM libcxx Credits.txt'. See 'LLVM libcxx License.txt' for details.
16 *
17 * References are to ISO/IEC 14882:2011(E) Third edition (2011-09-01).
18 */
19
20#include <cmsis-plus/rtos/os.h>
22
23// ----------------------------------------------------------------------------
24
25#if defined(__clang__)
26#pragma clang diagnostic ignored "-Wc++98-compat"
27#endif
28
29// ----------------------------------------------------------------------------
30
31using namespace os;
32
33// ----------------------------------------------------------------------------
34
35namespace os
36{
37 namespace estd
38 {
39 // ========================================================================
40
41 [[noreturn]] void
43 {
44#if defined(__EXCEPTIONS)
45 throw std::bad_alloc ();
46#else
47 trace::printf ("bad_alloc()\n");
48 std::abort ();
49#endif
50 }
51
52 namespace pmr
53 {
54 // ----------------------------------------------------------------------
55
58 {
59 trace::printf ("estd::pmr::%s(%p) \n", __func__, res);
60
62 default_resource = res;
63
64 return old;
65 }
66
67 // ----------------------------------------------------------------------
68 } /* namespace pmr */
69 } /* namespace estd */
70} /* namespace os */
71
72// ----------------------------------------------------------------------------
Memory resource manager (abstract class).
Definition os-memory.h:159
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:59
memory_resource * set_default_resource(memory_resource *res) noexcept
Set the default application memory manager.
memory_resource * default_resource
void __throw_bad_alloc(void)
System namespace.
Single file µOS++ RTOS definitions.