Module: kamailio
Branch: master
Commit: ef50e77b80d0b33b317263018101d5801c0860f8
URL:
https://github.com/kamailio/kamailio/commit/ef50e77b80d0b33b317263018101d58…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-07-11T13:22:29+02:00
core/mem: qm - test and print status for chunks start/end markers for mem status
---
Modified: mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ef50e77b80d0b33b317263018101d58…
Patch:
https://github.com/kamailio/kamailio/commit/ef50e77b80d0b33b317263018101d58…
---
diff --git a/mem/q_malloc.c b/mem/q_malloc.c
index 4b8014c..3356731 100644
--- a/mem/q_malloc.c
+++ b/mem/q_malloc.c
@@ -751,7 +751,7 @@ void qm_check(struct qm_block* qm)
(FRAG_END(f)->check2 != END_CHECK_PATTERN2)) {
LOG(L_CRIT, "BUG: qm_*: fragm. %p (address %p)"
" end overwritten(%lx, %lx)!\n",
- f, (char*)f + sizeof(struct qm_frag),
+ f, (char*)f + sizeof(struct qm_frag),
FRAG_END(f)->check1, FRAG_END(f)->check2);
qm_status(qm);
abort();
@@ -787,7 +787,7 @@ void qm_status(void* qmp)
qm->used, qm->real_used, qm->size-qm->real_used);
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
"max used (+overhead)= %lu\n", qm->max_real_used);
-
+
if (mem_summary & 16) return;
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
@@ -798,7 +798,7 @@ void qm_status(void* qmp)
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
" %3d. %c address=%p frag=%p size=%lu used=%d\n",
i,
- (f->u.is_free)?'a':'N',
+ (f->u.is_free)?'A':'N',
(char*)f+sizeof(struct qm_frag), f, f->size, FRAG_WAS_USED(f));
#ifdef DBG_QM_MALLOC
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
@@ -807,6 +807,18 @@ void qm_status(void* qmp)
LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
" start check=%lx, end check= %lx, %lx\n",
f->check, FRAG_END(f)->check1, FRAG_END(f)->check2);
+ if (f->check!=ST_CHECK_PATTERN){
+ LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
+ " * beginning overwritten(%lx)!\n",
+ f->check);
+ }
+ if ((FRAG_END(f)->check1 != END_CHECK_PATTERN1)
+ || (FRAG_END(f)->check2 != END_CHECK_PATTERN2)) {
+ LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
+ " * end overwritten(%lx, %lx)!\n",
+ FRAG_END(f)->check1, FRAG_END(f)->check2);
+ }
+
#endif
}
}
@@ -814,7 +826,7 @@ void qm_status(void* qmp)
"dumping free list stats :\n");
for(h=0,i=0;h<QM_HASH_SIZE;h++){
unused=0;
- for (f=qm->free_hash[h].head.u.nxt_free,j=0;
+ for (f=qm->free_hash[h].head.u.nxt_free,j=0;
f!=&(qm->free_hash[h].head); f=f->u.nxt_free, i++, j++){
if (!FRAG_WAS_USED(f)){
unused++;