acl  3.5.3.0
acl_mem_hook.h
浏览该文件的文档.
1 #ifndef ACL_MEM_HOOK_INCLUDE_H
2 #define ACL_MEM_HOOK_INCLUDE_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include "acl_define.h"
9 
10 /**
11  * 设置内存分配、释放的注册函数,当ACL内部分配释放内存时便调用这些注册的函数
12  * 在调用此函数进行注册时必须保证这几个函数指针参数均非空
13  * @param malloc_hook {void *(*)(const char* fname, int lineno, size_t)}
14  * @param calloc_hook {void *(*)(const char* fname, int lineno, size_t, size_t)}
15  * @param realloc_hook {void *(*)(const char* fname, int lineno, void *, size_t)}
16  * @param strdup_hook {void *(*)(const char* fname, int lineno, const char*)}
17  * @param strndup_hook {void *(*)(const char* fname, int lineno, const char*, size_t)}
18  * @param memdup_hook {void *(*)(const char* fname, int lineno, const void *, size_t)}
19  * @param free_hook {void (*)(const char* fname, int lineno, void*)}
20  */
21 ACL_API void acl_mem_hook(void *(*malloc_hook)(const char*, int, size_t),
22  void *(*calloc_hook)(const char*, int, size_t, size_t),
23  void *(*realloc_hook)(const char*, int, void*, size_t),
24  char *(*strdup_hook)(const char*, int, const char*),
25  char *(*strndup_hook)(const char*, int, const char*, size_t),
26  void *(*memdup_hook)(const char*, int, const void*, size_t),
27  void (*free_hook)(const char*, int, void*));
28 
29 /**
30  * 取消之前设置的内存勾子函数,恢复为缺省状态
31  */
32 ACL_API void acl_mem_unhook(void);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif
ACL_API void acl_mem_unhook(void)
ACL_API void acl_mem_hook(void *(*malloc_hook)(const char *, int, size_t), void *(*calloc_hook)(const char *, int, size_t, size_t), void *(*realloc_hook)(const char *, int, void *, size_t), char *(*strdup_hook)(const char *, int, const char *), char *(*strndup_hook)(const char *, int, const char *, size_t), void *(*memdup_hook)(const char *, int, const void *, size_t), void(*free_hook)(const char *, int, void *))