Thank you for your precisions :) On Mon 25 Jan 2021 10:15:00 GMT, Maria Matejka wrote:
Hello!
My first thought would be that BIRD called free() on that memory, not necessarily returning the memory back to the kernel.
This may change in some new versions with changing at least some of the memory allocations to mmap/munmap. This should help a lot with this specific problem, anyway it is not going to happen in the next version.
It may also sometimes be possible to run reconfiguration several times to trigger the LibC's internal memory release algorithms, anyway all of this magic is mostly just a cargo cult.
Maria
On 1/25/21 8:08 AM, Alarig Le Lay wrote:
Hi,
On one of my routers, I needed to free some RAM temporally, so I shut all my BGP sessions. With `birdc show memory` I saw that it should have worked, however htop was still seeing 1.2G used by bird.
5311 root 20 0 1296M 1220M 1724 S 0.0 61.1 59h01:29 ├─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.conf - 5314 root 20 0 1296M 1220M 1724 S 0.7 61.1 6h31:09 │ └─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.con
bird> show memory BIRD memory usage Routing tables: 49 MB Route attributes: 842 kB Protocols: 300 kB Total: 50 MB
So, I added the `disabled` option to my sessions and restarted bird, and then birdc and htop were almost consistent.
25724 root 20 0 107M 32600 2224 S 0.7 1.6 0:00.62 ├─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.conf - 25726 root 20 0 107M 32600 2224 S 0.7 1.6 0:00.16 │ └─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.con
bird> show memory BIRD memory usage Routing tables: 28 MB Route attributes: 46 kB Protocols: 304 kB Total: 29 MB
When I re-enabled the BGP sessions, the RAM utilisation was a bit lower (the original process was two months old).
25724 root 20 0 1147M 1072M 2072 R 1.3 53.7 2:33.80 ├─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.conf - 25726 root 20 0 1147M 1072M 2072 S 0.7 53.7 0:07.84 │ └─ /usr/sbin/bird -s /run/bird.ctl -c /etc/bird.con
bird> show memory BIRD memory usage Routing tables: 399 MB Route attributes: 528 MB Protocols: 102 MB Total: 1029 MB
Perhaps bird thinks that some RAM has been freed while it’s not actually the case?