44#pragma clang diagnostic ignored "-Wc++98-compat"
65#pragma GCC diagnostic push
67#pragma clang diagnostic ignored "-Wexit-time-destructors"
68#pragma clang diagnostic ignored "-Wglobal-constructors"
80 static std::aligned_storage<
103 __attribute__((constructor))
111#pragma GCC diagnostic pop
122#if !defined(OS_IS_CROSS_BUILD)
217 default_resource = res;
237 resource_thread = res;
255 resource_condition_variable = res;
273 resource_event_flags = res;
291 resource_memory_pool = res;
309 resource_message_queue = res;
327 resource_mutex = res;
345 resource_semaphore = res;
363 resource_timer = res;
425 return &other ==
this;
478 std::size_t bytes)
noexcept
482 allocated_bytes_ += bytes;
483 if (allocated_bytes_ > max_allocated_bytes_)
485 max_allocated_bytes_ = allocated_bytes_;
487 free_bytes_ -= bytes;
494 std::size_t bytes)
noexcept
498 allocated_bytes_ -= bytes;
499 free_bytes_ += bytes;
524 return reinterpret_cast<memory_resource*
> (&rtos::memory::new_delete_res);
533#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.