]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common: add destructor to intrusive_lru 54558/head
authorAli Maredia <amaredia@redhat.com>
Thu, 15 Sep 2022 18:43:37 +0000 (14:43 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Fri, 24 Nov 2023 06:03:05 +0000 (13:03 +0700)
commit65b22e8cb6180fe30865b8883eb3d15f29d7d1fa
tree0ba3a5c40853c76c490db88ff22b9fb4b23327b3
parentef6ea6c2b1a99911692a4fff0697dde2f2f16bba
common: add destructor to intrusive_lru

values created during inserts that are
unreferenced are not deleted because evict()
does not delete values unless set.size() > lru_target_size.

For example, this condition is not met if the number
of entries in the intrusive_lru are less than or
equal to lru_target_size at the time of the
intrusive_lru's destruction.

Memory leaks due to the above scenario can be
reproduced if this commit is removed and
unittest_intrusive_lru is run under valgrind.

ex:

valgrind --tool=memcheck --leak-check=yes ./bin/unittest_intrusive_lru

Signed-off-by: Ali Maredia <amaredia@redhat.com>
(cherry picked from commit abd84ad770ffe10771aeae060514a42e76150569)
src/common/intrusive_lru.h