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

[swig]: Fix swig template memory leak on issue 17025 (#876) #907

Closed

Conversation

Pterosaur
Copy link
Contributor

@Pterosaur Pterosaur commented Aug 28, 2024

Fix the issue sonic-net/sonic-buildimage#17025 about Redis set activity

Description

The issue reports a memory leak on the Redis set operations

Reason

  1. Didn't decrease the reference count after PySequence_GetItem
  2. Use the inappropriate Swig API and didn't release the string of SWIG_AsPtr_std_string

Fix:

  1. Refer PR: Fix swig template memory leak #859 from @praveenraja1
  2. Replace the API SWIG_AsPtr_std_string to SWIG_AsVal_std_string

Add unit test

To monitor there is no dramatic memory increment after a huge amount of Redis set operations.

Fix the issue sonic-net/sonic-buildimage#17025 about Redis set activity

Description
The issue reports a memory leak on the Redis set operations

Reason
Didn't decrease the reference count after PySequence_GetItem
Use the inappropriate Swig API and didn't release the string of SWIG_AsPtr_std_string
Fix:
Refer PR: Fix swig template memory leak sonic-net#859 from @praveenraja1
Replace the API SWIG_AsPtr_std_string to SWIG_AsVal_std_string
Add unit test
To monitor there is no dramatic memory increment after a huge amount of Redis set operations.

Signed-off-by: Ze Gan <zegan@microsoft.com>
@Pterosaur Pterosaur closed this Aug 28, 2024
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.

1 participant