1 Star 1 Fork 0

Hardhuang/内存管理malloc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
malloc.h 2.76 KB
一键复制 编辑 原始数据 按行查看 历史
Hardhuang 提交于 2020-12-21 10:04 . 实现RT-Thread的独立编译
#ifdef __cplusplus
extern "C" {
#endif
#include "stdio.h"
typedef int rt_bool_t; /**< boolean type */
typedef long rt_base_t; /**< Nbit CPU related date type */
typedef unsigned long rt_ubase_t; /**< Nbit unsigned CPU related data type */
typedef signed char rt_int8_t; /**< 8bit integer type */
typedef signed short rt_int16_t; /**< 16bit integer type */
typedef signed int rt_int32_t; /**< 32bit integer type */
typedef unsigned char rt_uint8_t; /**< 8bit unsigned integer type */
typedef unsigned short rt_uint16_t; /**< 16bit unsigned integer type */
typedef unsigned int rt_uint32_t; /**< 32bit unsigned integer type */
typedef rt_ubase_t rt_size_t; /**< Type for size number */
#define RT_DEBUG_MEM 1
#ifndef RT_DEBUG_MEM
#define RT_DEBUG_MEM 0
#endif
#define RT_ALIGN_SIZE 4
#define RT_NULL (0)
#define RT_DEBUG_LOG(type, message) \
do \
{ \
if (type) \
printf message; \
} \
while (0)
#define RT_ASSERT(EX) \
if (!(EX)) \
{ \
}
#define RTM_EXPORT(symbol)
/**
* The hook function call macro
*/
#ifdef RT_USING_HOOK
#define RT_OBJECT_HOOK_CALL(func, argv) \
do { if ((func) != RT_NULL) func argv; } while (0)
#else
#define RT_OBJECT_HOOK_CALL(func, argv)
#endif
/**
* @ingroup BasicDef
*
* @def RT_ALIGN(size, align)
* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
* would return 16.
*/
#define RT_ALIGN(size, align) (((size) + (align) - 1) & ~((align) - 1))
/**
* @ingroup BasicDef
*
* @def RT_ALIGN_DOWN(size, align)
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
* would return 12.
*/
#define RT_ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
void rt_system_heap_init(void *begin_addr, void *end_addr);
void *rt_malloc(rt_size_t size);
void *rt_realloc(void *rmem, rt_size_t newsize);
void *rt_calloc(rt_size_t count, rt_size_t size);
void rt_free(void *rmem);
#ifdef __cplusplus
}
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/huangqinggan/memory-management-malloc.git
git@gitee.com:huangqinggan/memory-management-malloc.git
huangqinggan
memory-management-malloc
内存管理malloc
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385