mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 08:13:22 +00:00
make MALLOC_DEBUG build work properly (issue #4970 with additional changes)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
5
Makefile
5
Makefile
@@ -204,6 +204,11 @@ GREP=/usr/xpg4/bin/grep
|
|||||||
M4=/usr/local/bin/m4
|
M4=/usr/local/bin/m4
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# if doing a recursive make, don't double-up CFLAGS
|
||||||
|
ifeq ($(MAKECMDGOALS),ast_expr.a)
|
||||||
|
CFLAGS=
|
||||||
|
endif
|
||||||
|
|
||||||
INCLUDE=-Iinclude -I../include
|
INCLUDE=-Iinclude -I../include
|
||||||
CFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
|
CFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
|
||||||
CFLAGS+=$(OPTIMIZE)
|
CFLAGS+=$(OPTIMIZE)
|
||||||
|
5
astmm.c
5
astmm.c
@@ -26,6 +26,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/logger.h"
|
#include "asterisk/logger.h"
|
||||||
#include "asterisk/options.h"
|
#include "asterisk/options.h"
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
|
#include "asterisk/strings.h"
|
||||||
|
|
||||||
#define SOME_PRIME 563
|
#define SOME_PRIME 563
|
||||||
|
|
||||||
@@ -253,7 +254,7 @@ static int handle_show_memory(int fd, int argc, char *argv[])
|
|||||||
reg = regions[x];
|
reg = regions[x];
|
||||||
while (reg) {
|
while (reg) {
|
||||||
if (!fn || !strcasecmp(fn, reg->file)) {
|
if (!fn || !strcasecmp(fn, reg->file)) {
|
||||||
ast_cli(fd, "%10d bytes allocated in %20s at line %5d of %s\n", reg->len, reg->func, reg->lineno, reg->file);
|
ast_cli(fd, "%10d bytes allocated in %20s at line %5d of %s\n", (int) reg->len, reg->func, reg->lineno, reg->file);
|
||||||
len += reg->len;
|
len += reg->len;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -357,7 +358,7 @@ void __ast_mm_init(void)
|
|||||||
ast_cli_register(&show_memory_allocations_cli);
|
ast_cli_register(&show_memory_allocations_cli);
|
||||||
ast_cli_register(&show_memory_summary_cli);
|
ast_cli_register(&show_memory_summary_cli);
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "%s/mmlog", (char *)ast_config_AST_LOG_DIR)
|
snprintf(filename, sizeof(filename), "%s/mmlog", (char *)ast_config_AST_LOG_DIR);
|
||||||
mmlog = fopen(filename, "a+");
|
mmlog = fopen(filename, "a+");
|
||||||
if (option_verbose)
|
if (option_verbose)
|
||||||
ast_verbose("Asterisk Malloc Debugger Started (see %s))\n", filename);
|
ast_verbose("Asterisk Malloc Debugger Started (see %s))\n", filename);
|
||||||
|
Reference in New Issue
Block a user