Skip to content

Conversation

@lgarrison
Copy link
Collaborator

From #227, I think we have a Python reference leak to the results structure. Specifically, I think the following pattern results in a leak:

PyObject *ret = PyList_New(0);//create an empty list
...
return Py_BuildValue("(Od)", ret, c_api_time);

PyBuildValue adds a ref, but the PyList_New reference is never decremented. This PR decrements the ref count after building the tuple, before the return.

Once we verify the fix, I'll port it to the other modules.

@lgarrison lgarrison requested a review from manodeep August 14, 2020 19:38
@lgarrison lgarrison mentioned this pull request Aug 14, 2020
@lgarrison
Copy link
Collaborator Author

This is confirmed: sys.getrefcount(extn_results) in DDrppi.py returns 3 instead of 2 without the fix.

@manodeep manodeep linked an issue Aug 15, 2020 that may be closed by this pull request
@lgarrison lgarrison added this to the v2.3.5 milestone Aug 17, 2020
@lgarrison lgarrison merged commit 7dd17ce into master Aug 17, 2020
@lgarrison lgarrison deleted the gh227-refleak branch August 17, 2020 22:29
lgarrison added a commit that referenced this pull request Nov 18, 2020
just to save effort of doing two releases back to back!
@lgarrison lgarrison modified the milestones: v2.3.5, v2.4.0 Nov 18, 2020
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.

DDrppi bug memory leak

3 participants