mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
core: Add some documentation to the malloc_trim code
This adds documentation to handle_cli_malloc_trim() indicating how it can be useful when debugging OOM conditions. Change-Id: I1936185e78035bf123cd5e097b793a55eeebdc78
This commit is contained in:
15
main/cli.c
15
main/cli.c
@@ -1781,7 +1781,19 @@ static char *handle_cli_wait_fullybooted(struct ast_cli_entry *e, int cmd, struc
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_TRIM
|
#ifdef HAVE_MALLOC_TRIM
|
||||||
/* BUGBUG malloc_trim() is a libc specific function. Non-portable. */
|
|
||||||
|
/*!
|
||||||
|
* \internal
|
||||||
|
* \brief Attempt to reclaim unused heap memory.
|
||||||
|
*
|
||||||
|
* Users have reported that asterisk will sometimes be killed because it can't allocate
|
||||||
|
* more than around 3G of memory on a 32 bit system.
|
||||||
|
*
|
||||||
|
* Using malloc_trim() will help us to determine if it's because there's a leak or because
|
||||||
|
* the heap is so fragmented that there isn't enough contiguous memory available.
|
||||||
|
*
|
||||||
|
* \note malloc_trim() is a GNU extension and is therefore not portable.
|
||||||
|
*/
|
||||||
static char *handle_cli_malloc_trim(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_cli_malloc_trim(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
extern int malloc_trim(size_t __pad) __THROW;
|
extern int malloc_trim(size_t __pad) __THROW;
|
||||||
@@ -1805,6 +1817,7 @@ static char *handle_cli_wait_fullybooted(struct ast_cli_entry *e, int cmd, struc
|
|||||||
|
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
||||||
|
Reference in New Issue
Block a user