Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sairedis] Change static variable to use smart pointers instead of raw pointers #1179

Closed
wants to merge 1 commit into from

Conversation

liorghub
Copy link
Contributor

Why I did it

To fix a memory issue.

How I did it

Used smart pointers in order for memory to be released when not being referenced anymore.

How to verify it

Run auto negotiation interfaces tests.
On 202205 latest, the following leaks occur, after the fix issue not reproduced.

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7f5076865647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55a6717aad43 in declare_static<syncd::SwitchNotifications::SlotBase, syncd::SwitchNotifications::Slot, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15> syncd/SwitchNotifications.cpp:113
    #2 0x55a6717aad43 in declare_static<syncd::SwitchNotifications::SlotBase, syncd::SwitchNotifications::Slot, 16> syncd/SwitchNotifications.cpp:120
    #3 0x55a6717aad43 in __static_initialization_and_destruction_0 syncd/SwitchNotifications.cpp:124
    #4 0x55a6717aad43 in _GLOBAL__sub_I_SwitchNotifications.cpp syncd/SwitchNotifications.cpp:160

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f5076865647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55a6717aa680 in declare_static<syncd::ServiceMethodTable::SlotBase, syncd::ServiceMethodTable::Slot, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9> syncd/ServiceMethodTable.cpp:74
    #2 0x55a6717aa680 in declare_static<syncd::ServiceMethodTable::SlotBase, syncd::ServiceMethodTable::Slot, 10> syncd/ServiceMethodTable.cpp:81
    #3 0x55a6717aa680 in __static_initialization_and_destruction_0 syncd/ServiceMethodTable.cpp:85
    #4 0x55a6717aa680 in _GLOBAL__sub_I_ServiceMethodTable.cpp syncd/ServiceMethodTable.cpp:121

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

@liorghub liorghub closed this Dec 20, 2022
@kcudnik
Copy link
Collaborator

kcudnik commented Mar 9, 2023

this is actually good change, why closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants