Go to the source code of this file.
◆ ZRTOS_MALLOC__BYTE_ALIGNMENT
◆ ZRTOS_MALLOC__GET_REQUIRED_SIZE
#define ZRTOS_MALLOC__GET_REQUIRED_SIZE |
( |
|
type, |
|
|
|
count |
|
) |
| |
Value: + ( \
( \
) \
* (count) \
) \
)
size_t zrtos_types__ceil_size_to_alignment(size_t len)
struct _zrtos_malloc_internal_t zrtos_malloc_internal_t
Definition at line 39 of file malloc.h.
◆ ZRTOS_MALLOC__GLOBAL_HEAP
#define ZRTOS_MALLOC__GLOBAL_HEAP |
( |
|
name, |
|
|
|
len |
|
) |
| |
Value: (len) \
\
void *kmalloc(size_t length){ \
name \
,length \
); \
} \
\
void kfree(void *ptr){ \
zrtos_malloc__free(ptr); \
}
#define ZRTOS_ASSERT__STATIC(cond)
#define ZRTOS_MALLOC__BYTE_ALIGNMENT
void * zrtos_malloc__malloc(zrtos_malloc_t *thiz, size_t length)
Definition at line 65 of file malloc.h.
◆ ZRTOS_MALLOC__GLOBAL_HEAP_INIT
#define ZRTOS_MALLOC__GLOBAL_HEAP_INIT |
( |
|
name | ) |
|
Value: name \
,sizeof(name) / sizeof(name[0]) \
zrtos_debug__memset( \
,0xFF \
,(sizeof(name) / sizeof(name[0])) \
); \
});
#define ZRTOS_DEBUG__CODE(code)
bool zrtos_malloc__init(zrtos_malloc_t *thiz, size_t length)
void * zrtos_types__ptr_add(void *ptr, size_t byte_len)
Definition at line 50 of file malloc.h.
◆ ZRTOS_MALLOC__INIT
#define ZRTOS_MALLOC__INIT |
( |
|
name, |
|
|
|
len |
|
) |
| |
Value: (len) \
name \
,sizeof(name) / sizeof(name[0]) \
)
#define ZRTOS_ASSERT__STATIC(cond)
bool zrtos_malloc__init(zrtos_malloc_t *thiz, size_t length)
#define ZRTOS_MALLOC__BYTE_ALIGNMENT
Definition at line 83 of file malloc.h.
◆ zrtos_malloc_heap_chunk_t
◆ zrtos_malloc_internal_t
◆ zrtos_malloc_t
◆ zrtos_malloc__free()
void zrtos_malloc__free |
( |
void * |
ptr | ) |
|
Definition at line 220 of file malloc.h.
221 #ifndef ZRTOS_MALLOC__CFG_DISABLE_FREE 230 zrtos_debug__memset(ptr,0xFF,(chunk->
length >> 1));
#define ZRTOS_CAST(type, value)
#define ZRTOS_DEBUG__CODE(code)
◆ zrtos_malloc__get_free_chunk()
Definition at line 112 of file malloc.h.
121 while(chunk != last){
122 if((chunk->
length & 1) == 0
123 && (chunk->
length >> 1) == length){
void * zrtos_types__ptr_add(void *ptr, size_t byte_len)
◆ zrtos_malloc__get_length()
size_t zrtos_malloc__get_length |
( |
void * |
ptr | ) |
|
Definition at line 205 of file malloc.h.
211 return (chunk->
length >> 1);
#define ZRTOS_CAST(type, value)
◆ zrtos_malloc__init()
Definition at line 95 of file malloc.h.
103 zrtos_debug__memset(thiz_->
ptr,0xFF,length);
#define ZRTOS_DEBUG__CODE(code)
void * zrtos_types__ptr_add(void *ptr, size_t byte_len)
struct _zrtos_malloc_internal_t zrtos_malloc_internal_t
◆ zrtos_malloc__malloc()
Definition at line 142 of file malloc.h.
143 #ifndef ZRTOS_MALLOC__CFG_DISABLE_FREE 148 bool has_free_space = (thiz_->
length 156 if(aligned_length > (SIZE_MAX>>1)){
161 }
else if(has_free_space){
163 chunk->
length = (aligned_length << 1) | 1;
164 thiz_->
ptr += total_length;
173 zrtos_debug__memset(chunk,pattern++,aligned_length);
182 bool has_free_space = (thiz_->
length 192 thiz_->
ptr += aligned_length;
197 zrtos_debug__memset(ret,pattern++,aligned_length);
#define ZRTOS_DEBUG__CODE(code)
struct _zrtos_malloc_heap_chunk_t zrtos_malloc_heap_chunk_t
size_t zrtos_types__ptr_get_byte_distance(void *bigger, void *smaller)
static zrtos_malloc_heap_chunk_t * zrtos_malloc__get_free_chunk(zrtos_malloc_t *thiz, size_t length)
size_t zrtos_types__ceil_size_to_alignment(size_t len)