[sr-dev] [kamailio] Possible Kamailio presence server (BLF) memory leak (#155)

Odorik.cz notifications at github.com
Mon May 11 16:14:18 CEST 2015


### I do next test, how many memory leak in time each 100 calls in kb:
```
in (is used memory from FREE before and after SIPP command)
first 100 calls (928188-926836)/100.0=13.52
next 100 calls total 200 calls (932564-928188)/100.0=43.76
next 100 after total 300 calls (942832-932564)/100.0=102.68
next 100 after total 400 calls (961088-942832)/100.0=182.56
next 100 after total 500 calls (989580-961088)/100.0=284.92
next 100 after total 600 calls (1030704-989580)/100.0=411.24
next 100 after total 700 calls (1086652-1030704)/100.0=559.48
next 100 after total 800 calls (1159984-1086652)/100.0=733.32
```

### code:
```
 cat count_mem_seq.sh 
#!/bin/bash
 cc=0
while true; do
  echo "---------------------------------------- after $cc calls"
  free
  echo "Presence          Kbytes     RSS   Dirty"
  for line in $(pgrep -f '/usr/local/kamailio-dev/sbin/kamailio -f /usr/local/kamailio-dev/etc/kamailio/kamailio.cfg -P /var/run/kamailio_dev/kamailio_dev.pid -m 16 -M 8 -u root -g root')
  do
    pms=$(pmap -x $line|grep total)
    echo "$pms pid:$line"
  done

  echo "----------------------------------------"
  ./sipp -nostdin -sf ./uac.xml -p 5099 -s uas -r 2 -rp 1000 -m 100 81.31.45.53:6688 -trace_err -inf ./inf3.csv > /dev/null 2>&1
  if [ $? != 0 ];then
    exit
  fi
    let cc+=100
done
```

### output:
```
---------------------------------------- after 0 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     926836     273164          0          0     926836
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          138012    4504    1748 pid:32512
total kB          138012    2892    1444 pid:32513
total kB          138012    2904    1456 pid:32514
total kB          138012    4500    1744 pid:32515
total kB          138012    2748    1568 pid:32516
total kB          138012    2840    1880 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 100 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     928188     271812          0          0     928188
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          138360    6992    3816 pid:32512
total kB          138356    6848    3824 pid:32513
total kB          138356    6824    3800 pid:32514
total kB          138352    6992    3816 pid:32515
total kB          138012    2748    1568 pid:32516
total kB          138012    4320    3312 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 200 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     932564     267436          0          0     932564
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          139460    8616    5440 pid:32512
total kB          139444    8452    5428 pid:32513
total kB          139460    8444    5420 pid:32514
total kB          139436    8652    5476 pid:32515
total kB          138012    2768    1576 pid:32516
total kB          138012    4792    3784 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 300 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     942832     257168          0          0     942832
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          141924   11364    8188 pid:32512
total kB          142060   11244    8220 pid:32513
total kB          142000   11212    8188 pid:32514
total kB          142080   11480    8304 pid:32515
total kB          138012    2772    1580 pid:32516
total kB          138012    5020    4012 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 400 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     961088     238912          0          0     961088
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          146560   16200   13024 pid:32512
total kB          146652   16084   13060 pid:32513
total kB          146436   15888   12864 pid:32514
total kB          146672   16348   13172 pid:32515
total kB          138012    2776    1584 pid:32516
total kB          138012    5260    4252 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 500 calls
             total       used       free     shared    buffers     cached
Mem:       1200000     989580     210420          0          0     989580
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          153684   23544   20368 pid:32512
total kB          153648   23324   20300 pid:32513
total kB          153316   22940   19916 pid:32514
total kB          154164   23940   20764 pid:32515
total kB          138012    2784    1592 pid:32516
total kB          138012    5468    4460 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 600 calls
             total       used       free     shared    buffers     cached
Mem:       1200000    1030704     169296          0          0    1030704
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          164568   34476   31300 pid:32512
total kB          163940   33748   30724 pid:32513
total kB          163264   32968   29944 pid:32514
total kB          164164   34072   30896 pid:32515
total kB          138012    2788    1596 pid:32516
total kB          138012    5556    4548 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 700 calls
             total       used       free     shared    buffers     cached
Mem:       1200000    1086652     113348          0          0    1086652
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          178948   48964   45788 pid:32512
total kB          177908   47752   44728 pid:32513
total kB          176796   46708   43684 pid:32514
total kB          178232   48240   45064 pid:32515
total kB          138012    2796    1604 pid:32516
total kB          138012    5652    4644 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 800 calls
             total       used       free     shared    buffers     cached
Mem:       1200000    1159984      40016          0          0    1159984
-/+ buffers/cache:          0    1200000
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          196988   67156   63980 pid:32512
total kB          196500   66560   63536 pid:32513
total kB          195200   65208   62184 pid:32514
total kB          196528   66696   63520 pid:32515
total kB          138012    2800    1608 pid:32516
total kB          138012    5784    4776 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
---------------------------------------- after 900 calls
             total       used       free     shared    buffers     cached
Mem:       1200000    1198932       1068          0          0    1185360
-/+ buffers/cache:      13572    1186428
Swap:            0          0          0
Presence          Kbytes     RSS   Dirty
total kB          138012    6388    3512 pid:32509
total kB          205940   76344   73112 pid:32512
total kB          206212   76440   73360 pid:32513
total kB          204848   75096   72020 pid:32514
total kB          207164   76592   73368 pid:32515
total kB          138012    2800    1608 pid:32516
total kB          138012    5876    4868 pid:32517
total kB          138016    1968    1220 pid:32518
total kB          138012    2224    1220 pid:32519
total kB          138012    2348    1560 pid:32520
----------------------------------------
```

#### BTW: I try create same BLF presence server with opensip, which not have memory leak, but stop response after call refer.

#### I hope that it`s help.

---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/155#issuecomment-100921469
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150511/5331288a/attachment.html>


More information about the sr-dev mailing list