📄 yc_memory.h
字号:
/*
* The young Library
* Copyright (c) 2005 by Yang Huan(杨桓)
* Permission to use, copy, modify, distribute and sell this software for any
* purpose is hereby granted without fee, provided that the above copyright
* notice appear in all copies and that both that copyright notice and this
* permission notice appear in supporting documentation.
* The author make no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
*/
/******************************************************************************/
/******************************************************************************/
#ifndef __MACRO_C_YOUNG_LIBRARY_MEMORY_FUNCTION_HEADER_FILE__
#define __MACRO_C_YOUNG_LIBRARY_MEMORY_FUNCTION_HEADER_FILE__
/******************************************************************************/
#include "yc_definition.h"
#ifdef __cplusplus
namespace youngc { extern "C" {
#endif
/******************************************************************************/
/******************************************************************************/
/* 获取内存池中内存链的个数 */
size_t get_pool_lists_count( void );
/* 获取内存池执行分配的次数 */
size_t get_pool_alloc_count( void );
/* 获取内存池执行回收的次数 */
size_t get_pool_dealloc_count( void );
/* 设置在并行系统中使用的加锁函数 */
void set_pool_lock( void (*lock)(size_t index) );
/* 设置在并行系统中使用的解锁函数 */
void set_pool_unlock( void (*unlock)(size_t index) );
/* 打印内存池 */
void pool_print( void );
/* 向内存池中申请至少 bytes 个字节的内存块 */
void* pool_alloc( size_t bytes );
/* 将内存块回收至内存池 */
void pool_dealloc( void* ptr, size_t bytes );
/* 先将内存块回收至内存池,再将内存池中空闲的内存页释放 */
void pool_free( void* ptr, size_t bytes );
/******************************************************************************/
/******************************************************************************/
#ifdef __cplusplus
} }
#endif
#endif
/******************************************************************************/
/******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -