Skip to content

Commit

Permalink
core: mem - updated defines for sys malloc and mem error log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Jul 1, 2017
1 parent cee1de7 commit 1cc3f0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/core/mem/mem.h
Expand Up @@ -19,7 +19,7 @@
/**
* \defgroup mem Kamailio memory manager
* \brief Kamailio internal memory manager
*
*
* Kamailio internal memory manager for private (per process) and shared
* memory pools. It provides several different strategies for the memory
* management, like really fast, with extended debugging and also plain system
Expand All @@ -29,7 +29,7 @@
/**
* \file
* \brief Main definitions for memory manager
*
*
* \brief Main definitions for memory manager, like malloc, free and realloc
* \ingroup mem
*/
Expand Down Expand Up @@ -193,12 +193,12 @@ int init_shm_mallocs(int force_alloc);
#endif

/** generic logging helper for allocation errors in private memory pool/ system */
#ifdef SYSTEM_MALLOC
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from system")
#ifdef SYS_MALLOC
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from sys pool\n")
#else
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from available pool")
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from pkg pool\n")
#endif
/** generic logging helper for allocation errors in shared memory pool */
#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from available pool")
#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from shm pool\n")

#endif
4 changes: 3 additions & 1 deletion src/core/mem/pkg.h
Expand Up @@ -52,10 +52,12 @@ void pkg_print_manager(void);
# define pkg_mod_free_stats(x) _pkg_root.xfmodstats(x)

#else /*PKG_MALLOC*/

/* use system allocator */
# define SYS_MALLOC
# include <stdlib.h>
# include "memdbg.h"
# ifdef DBG_SYS_MALLOC
# ifdef DBG_SYS_MEMORY
# define pkg_malloc(s) \
( { void *____v123; ____v123=malloc((s)); \
MDBG("malloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
Expand Down

0 comments on commit 1cc3f0d

Please sign in to comment.