diff options
author | Ole Troan <ot@cisco.com> | 2019-06-16 12:33:51 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-06-18 13:01:15 +0000 |
commit | 92e3082199d10add866894e86a9762d79a3536c4 (patch) | |
tree | 224d269fba3ec3b0c5ca456a7ede032d4163335d /test | |
parent | ae8819f0a426953aa7ebf97c2e26940525b55fb1 (diff) |
stats: fix memory leakage when adding / deleting interfaces
This fixes two leaks in registering errors in the stats segment.
- The error name created by vlib_register_errors() was not freed.
- Duplicate error names (when interface readded) was added to the vector.
This fix also adds memory usage statistics for the statistics segment
as /mem/statseg/{used, total}
Change-Id: Ife98d5fc5baef5bdae426a5a1eef428af2b9ab8a
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_stats_client.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/test_stats_client.py b/test/test_stats_client.py index a0504fc45ab..672a77a0e0a 100644 --- a/test/test_stats_client.py +++ b/test/test_stats_client.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.7 import unittest - +import time import psutil from vpp_papi.vpp_stats import VPPStats @@ -42,6 +42,23 @@ class StatsClientTestCase(VppTestCase): "is not equal to " "ending client side file descriptor count: %s" % ( initial_fds, ending_fds)) + @unittest.skip("Manual only") + def test_mem_leak(self): + def loop(): + print('Running loop') + for i in range(50): + rv = self.vapi.papi.tap_create_v2(id=i, use_random_mac=1) + self.assertEqual(rv.retval, 0) + rv = self.vapi.papi.tap_delete_v2(sw_if_index=rv.sw_if_index) + self.assertEqual(rv.retval, 0) + + before = self.statistics.get_counter('/mem/statseg/used') + loop() + self.vapi.cli("memory-trace on stats-segment") + for j in range(100): + loop() + print(self.vapi.cli("show memory stats-segment verbose")) + print('AFTER', before, self.statistics.get_counter('/mem/statseg/used')) if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) |