SuperTinyKernel™ RTOS
1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_memory_allocator_malloc.h
Go to the documentation of this file.
1
/*
2
* SuperTinyKernel(TM) RTOS: Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
3
*
4
* Source: https://github.com/SuperTinyKernel-RTOS
5
*
6
* Copyright (c) 2022-2026 Neutron Code Limited <stk@neutroncode.com>. All Rights Reserved.
7
* License: MIT License, see LICENSE for a full text.
8
*/
9
10
#ifndef STK_MEMORY_ALLOCATOR_MALLOC_H_
11
#define STK_MEMORY_ALLOCATOR_MALLOC_H_
12
13
#include "
stk_memory_allocator.h
"
14
44
45
// Private memory allocators (we define malloc, free here to overcome absence of declaration in
46
// case of -ffreestanding compiler flag).
47
extern
"C"
void
*
malloc
(
size_t
size);
48
extern
"C"
void
free
(
void
*ptr);
49
50
void
*
stk::memory::MemoryAllocator::Weak::Allocate
(
size_t
size)
51
{
52
return
malloc
(size);
53
}
54
55
void
stk::memory::MemoryAllocator::Weak::Free
(
void
*ptr)
56
{
57
free
(ptr);
58
}
59
60
stk::memory::MemoryAllocator::Stats
stk::memory::MemoryAllocator::Weak::GetStats
()
61
{
62
// no statistics from malloc
63
return
Stats
();
64
}
65
66
#endif
/* STK_MEMORY_ALLOCATOR_MALLOC_H_ */
stk_memory_allocator.h
Memory allocator front-end with checked API and its weak backend hooks: stk::memory::MemoryAllocator.
malloc
void * malloc(size_t size)
free
void free(void *ptr)
stk::memory::MemoryAllocator::Stats
Snapshot of the memory allocator's statistics.
Definition
stk_memory_allocator.h:207
stk::memory::MemoryAllocator::Weak::GetStats
static Stats GetStats() __stk_weak
Get stats of memory allocation (backend hook, optional).
Definition
stk_memory_allocator_default.h:90
stk::memory::MemoryAllocator::Weak::Free
static void Free(void *ptr) __stk_weak
Free the memory chunk (backend hook).
Definition
stk_memory_allocator_default.h:81
stk::memory::MemoryAllocator::Weak::Allocate
static void * Allocate(size_t size) __stk_weak
Allocate the memory chunk (backend hook).
Definition
stk_memory_allocator_default.h:76
stk
include
memory
stk_memory_allocator_malloc.h
Generated by
1.16.1