DHCP resources need to be cleared
Try to add or delete 10000 connections. After all new connections are deleted, the memory usage of the connections using static IP addresses is small, and the memory usage of the connections using DHCP is large, which is about tens of MB.
-
1 Is this a problem, and will the memory be cleaned up if the test continues? I think may be some resources are released only when the NM process exits. After the service is restarted, the memory can be restored to the initial state.
-
2 By the way, lots of dhcp lease files generated under the /var/lib/NetworkManager/ directorydo not appear to be cleaned up.
Test script:
#!/bin/sh
LOOP=10000
systemctl status NetworkManager >~/1031.log
for ((i = 0; i < $LOOP; i++)); do
nmcli connection add con-name eth4 ifname eth4 type ethernet ipv4.addresses 192.199.199.199/24 ipv4.method manual
sleep 0.5
nmcli connection del eth4
sleep 0.5
done
systemctl status NetworkManager >>~/1031.log
for ((i = 0; i < $LOOP; i++)); do
nmcli connection add con-name eth4 ifname eth4 type ethernet
sleep 1
nmcli connection del eth4
sleep 1
done
systemctl status NetworkManager >>~/1031.log
result: mem-stat-of-NM.txt