[sr-dev] git:master:3a0888f3: core: mem - api extended to track module name in debugging mode

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 2 14:00:17 CET 2015


Module: kamailio
Branch: master
Commit: 3a0888f392c8e0e056c6b03cbd0013bfaba9e8aa
URL: https://github.com/kamailio/kamailio/commit/3a0888f392c8e0e056c6b03cbd0013bfaba9e8aa

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-02T13:41:04+01:00

core: mem - api extended to track module name in debugging mode

- memory operations will keep reference to module

---

Modified: mem/memapi.h

---

Diff:  https://github.com/kamailio/kamailio/commit/3a0888f392c8e0e056c6b03cbd0013bfaba9e8aa.diff
Patch: https://github.com/kamailio/kamailio/commit/3a0888f392c8e0e056c6b03cbd0013bfaba9e8aa.patch

---

diff --git a/mem/memapi.h b/mem/memapi.h
index e1b78a0..9f918f3 100644
--- a/mem/memapi.h
+++ b/mem/memapi.h
@@ -27,13 +27,13 @@
 #ifdef DBG_SR_MEMORY
 
 typedef void* (*sr_malloc_f)(void* mbp, unsigned long size,
-					const char* file, const char* func, unsigned int line);
-typedef void  (*sr_free_f)(void* mbp, void* p, const char* file, const char* func, 
-					unsigned int line);
+					const char* file, const char* func, unsigned int line, const char* mname);
+typedef void  (*sr_free_f)(void* mbp, void* p, const char* file, const char* func,
+					unsigned int line, const char* mname);
 typedef void* (*sr_realloc_f)(void* mbp, void* p, unsigned long size,
-					const char* file, const char* func, unsigned int line);
+					const char* file, const char* func, unsigned int line, const char* mname);
 typedef void* (*sr_resize_f)(void* mbp, void* p, unsigned long size,
-					const char* file, const char* func, unsigned int line);
+					const char* file, const char* func, unsigned int line, const char* mname);
 
 #else /*DBG_SR_MEMORY*/
 
@@ -51,6 +51,9 @@ typedef void  (*sr_mem_sums_f)(void* mbp);
 
 typedef void  (*sr_mem_destroy_f)(void);
 
+typedef void (*sr_mem_mod_get_stats_f)(void* mbp, void **p);
+typedef void (*sr_mem_mod_free_stats_f)(void* mbp);
+
 /*private memory api*/
 typedef struct sr_pkg_api {
 	/*memory manager name - soft copy*/
@@ -75,6 +78,10 @@ typedef struct sr_pkg_api {
 	sr_mem_sums_f      xsums;
 	/*memory destroy manager*/
 	sr_mem_destroy_f   xdestroy;
+	/*memory stats per module*/
+	sr_mem_mod_get_stats_f  xstats;
+	/*memory stats free per module*/
+	sr_mem_mod_free_stats_f xfstats;
 } sr_pkg_api_t;
 
 /*shared memory api*/
@@ -107,6 +114,10 @@ typedef struct sr_shm_api {
 	sr_mem_sums_f      xsums;
 	/*memory destroy manager*/
 	sr_mem_destroy_f   xdestroy;
+	/*memory stats per module*/
+	sr_mem_mod_get_stats_f  xstats;
+	/*memory stats free per module*/
+	sr_mem_mod_free_stats_f xfstats;
 } sr_shm_api_t;
 
 #endif




More information about the sr-dev mailing list