[fpmsyncd] Fix memory leak bug#864
[fpmsyncd] Fix memory leak bug#864prsunny merged 4 commits intosonic-net:masterfrom baiwei0427:master
Conversation
fpmsyncd/routesync.cpp
Outdated
| m_nl_sock = nl_socket_alloc(); | ||
| nl_connect(m_nl_sock, NETLINK_ROUTE); | ||
| rtnl_link_alloc_cache(m_nl_sock, AF_UNSPEC, &m_link_cache); | ||
|
|
Jipan-Yang
left a comment
There was a problem hiding this comment.
Could you check https://github.com/Azure/sonic-swss-common/blob/master/common/linkcache.cpp ? It might be more efficient to allocate cache once and reuse it with nl_cache_refill().
|
@jipanyang @stcheng I guess the memory leak bug is due to the reallocation of link cache when interface name cannot be resolved. Is this bug first introduced on 142673a#diff-4a3ea7752832ebd49f989cc95ae042e1? |
| { | ||
| m_nl_sock = nl_socket_alloc(); | ||
| nl_connect(m_nl_sock, NETLINK_ROUTE); | ||
| rtnl_link_alloc_cache(m_nl_sock, AF_UNSPEC, &m_link_cache); |
There was a problem hiding this comment.
Could this netlink connection and cache allocation be kept here and reused at RouteSync::getIfName()? So no need to create netlink connection and alloc cache for each route message?
|
@baiwei0427 yes, this pull request #61 is the place that introduced the function One question I have here is that, since you replaced the function In this case, the memory leak issue could also be addressed, is that correct? |
* Fix netlink memory leak of fpmsyncd * Refill netlink cache instead of reallocation * Allocate netlink socket and cache on the constructor function
* Add docker to 'show techsupport' command Signed-off-by: Shlomi Bitton <shlomibi@mellanox.com>
* Fix netlink memory leak of fpmsyncd * Refill netlink cache instead of reallocation * Allocate netlink socket and cache on the constructor function
* Change pubsub get_message API timeout to seconds * Update pubsub.cpp * Update pubsub.h --------- Co-authored-by: Qi Luo <qiluo-msft@users.noreply.github.com>
fpmsyncd: Fix memory leak bug
Signed-off-by: Wei Bai baiwei0427@gmail.com