Skip to content

Conversation

@smithdh
Copy link
Contributor

@smithdh smithdh commented Aug 28, 2024

No description provided.

Comment on lines +420 to 421
Py_BuildValue( "ON", pystatus, Py_BuildValue( "" ) );
Py_DECREF( pystatus );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the below do the same, i.e. use "NN" and drop the explicit Py_DECREF( pystatus );?

Suggested change
Py_BuildValue( "ON", pystatus, Py_BuildValue( "" ) );
Py_DECREF( pystatus );
Py_BuildValue( "NN", pystatus, Py_BuildValue( "" ) );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi. yes; I think that would do the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'm fine with the current version too. Please just move the PR out of draft when it's ready for review/merge. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the macOS errors have nothing to do with this, those tests sporadically fail on macOS, something we need to look at eventually, but for now, just push again or re-run the macOS build by hand and it should pass.

@smithdh
Copy link
Contributor Author

smithdh commented Aug 28, 2024

hi. right; i'm retrying the macos test. I'll move the PR out of draft; I wasn't able to find any more evident memory leaks, although I feel I may have missed some, given there were a number of places that needed changes, and some I only discovered some via tests that happened to reveal them.

There is some repeated initialisation of some python type object(s), e.g. at least variable "URLType", as these are declared static variables in .hh files. When included in different .cc files these refer to different instances of the variable. However I don't think the this actually gives a memory leak (a few too many objects allocated, but number is bounded), or any other problem as far as I could see. The easiest way to fix (given c++17) seemed to be to make these 'inline' rather than static, but for this patch I thought I'd leave that out. Can make a separate PR for that.

@smithdh smithdh marked this pull request as ready for review August 28, 2024 09:22
@amadio amadio added this to the 5.7.1 milestone Aug 28, 2024
@amadio
Copy link
Member

amadio commented Aug 28, 2024

The easiest way to fix (given c++17) seemed to be to make these 'inline' rather than static, but for this patch I thought I'd leave that out. Can make a separate PR for that.

Hi @smithdh, after confirming the memory leaks are fixed, I'm merging this as is. We can change the code with my suggestion later. A patch for the initialization, changing static with inline would be nice indeed, if you submit the pull request I will add it to the next release as well.

@amadio amadio merged commit 01a201c into xrootd:devel 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.

2 participants