21#if defined(OS_USE_OS_APP_CONFIG_H)
22#include <cmsis-plus/os-app-config.h>
33#pragma clang diagnostic ignored "-Wc++98-compat"
54#pragma GCC diagnostic push
56#pragma clang diagnostic ignored "-Wexit-time-destructors"
57#pragma clang diagnostic ignored "-Wglobal-constructors"
69 static std::aligned_storage<
89#pragma GCC diagnostic push
91#pragma clang diagnostic ignored "-Wreserved-identifier"
96 __attribute__((constructor))
101#pragma GCC diagnostic pop
105#pragma GCC diagnostic pop
116#if !defined(OS_IS_CROSS_BUILD)
211 default_resource = res;
231 resource_thread = res;
249 resource_condition_variable = res;
267 resource_event_flags = res;
285 resource_memory_pool = res;
303 resource_message_queue = res;
321 resource_mutex = res;
339 resource_semaphore = res;
357 resource_timer = res;
418 return &other ==
this;
471 std::size_t bytes)
noexcept
475 allocated_bytes_ += bytes;
476 if (allocated_bytes_ > max_allocated_bytes_)
478 max_allocated_bytes_ = allocated_bytes_;
480 free_bytes_ -= bytes;
487 std::size_t bytes)
noexcept
491 allocated_bytes_ -= bytes;
492 free_bytes_ += bytes;
517 return reinterpret_cast<memory_resource*
> (&rtos::memory::new_delete_res);
526#if !defined(OS_IS_CROSS_BUILD)
A memory manager that allocates memory via the system std::malloc() and deallocates via std::free().
A memory manager that allocates memory via the system operator new and deallocates via operator delet...
An internal memory manager that throws a bad_alloc() exception when trying to allocate.
Memory resource manager (abstract class).
virtual bool do_is_equal(memory_resource const &other) const noexcept
Implementation of the equality comparator.
virtual void do_reset(void) noexcept
Implementation of the function to reset the memory manager.
virtual bool do_coalesce(void) noexcept
Implementation of the function to coalesce free blocks.
void internal_increase_allocated_statistics(std::size_t bytes) noexcept
Update statistics after allocation.
void internal_decrease_allocated_statistics(std::size_t bytes) noexcept
Update statistics after deallocation.
virtual std::size_t do_max_size(void) const noexcept
Implementation of the function to get max size.
virtual ~memory_resource()
Destruct the memory resource object instance.
int printf(const char *format,...)
Write a formatted string to the trace device.
void init_once_default_resource(void)
memory_resource * set_default_resource(memory_resource *res) noexcept
Set the default RTOS system memory manager.
memory_resource * malloc_resource(void) noexcept
Get the address of a memory manager based on POSIX malloc().
memory_resource * set_resource_typed< condition_variable >(memory_resource *res) noexcept
memory_resource * set_resource_typed< message_queue >(memory_resource *res) noexcept
memory_resource * set_resource_typed< memory_pool >(memory_resource *res) noexcept
memory_resource * new_delete_resource(void) noexcept
Get the address of a memory manager based on new/delete.
memory_resource * set_resource_typed< event_flags >(memory_resource *res) noexcept
memory_resource * set_resource_typed< mutex >(memory_resource *res) noexcept
memory_resource * set_resource_typed< semaphore >(memory_resource *res) noexcept
memory_resource * set_resource_typed< thread >(memory_resource *res) noexcept
memory_resource * null_memory_resource(void) noexcept
Get the address of an ineffective memory manager.
memory_resource * set_resource_typed< timer >(memory_resource *res) noexcept
rtos::memory::memory_resource memory_resource
memory_resource * default_resource
Single file µOS++ RTOS definitions.