Merge memory checking functionality from sandbox

Change-Id: I304c789a752c9f4af4944ca14b9bf1e7644da15a
This commit is contained in:
Vladimir Chtchetkine
2010-02-12 08:59:58 -08:00
parent 5c734644ee
commit 75fba6888a
5 changed files with 1068 additions and 54 deletions

View File

@@ -70,13 +70,28 @@ struct HashTable {
/* Entry in malloc dispatch table. */
typedef struct MallocDebug MallocDebug;
struct MallocDebug {
/* Address of the actual malloc routine. */
void* (*malloc)(size_t bytes);
/* Address of the actual free routine. */
void (*free)(void* mem);
/* Address of the actual calloc routine. */
void* (*calloc)(size_t n_elements, size_t elem_size);
/* Address of the actual realloc routine. */
void* (*realloc)(void* oldMem, size_t bytes);
/* Address of the actual memalign routine. */
void* (*memalign)(size_t alignment, size_t bytes);
};
/* Malloc debugging initialization routine.
* This routine must be implemented in .so modules that implement malloc
* debugging. This routine is called once per process from malloc_init_impl
* routine implemented in bionic/libc/bionic/malloc_debug_common.c when malloc
* debugging gets initialized for the process.
* Return:
* 0 on success, -1 on failure.
*/
typedef int (*MallocDebugInit)(void);
#ifdef __cplusplus
}; /* end of extern "C" */
#endif