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

Vector cleared after use so it can be shrunk. #1639

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

simpsonst
Copy link
Contributor

Sorry, I missed something in 5ea2004. The vector::shrink_to_fit call at XrdTpcStream.hh line 133 relies upon the vector size (which used to be always 0) being less than its capacity. (It seems it's only invoked when 'low buffer occupancy' is detected.) Now the (size, capacity) will only ever be either (0, 0) or (m_capacity, >=m_capacity), instead of (0, 0) or (0, m_capacity), so shrink_to_fit won't be able to fully de-allocate. I don't think it's a functional failure, but it could mean the allocation is retained for longer than expected.
By clearing the vector just after its contents are transmitted (and when m_size and m_offset are reset, marking the buffer as empty and available), shrink_to_fit should become effective again.

@abh3 abh3 merged commit ebf9de7 into xrootd:master Mar 16, 2022
@simpsonst simpsonst deleted the resize-for-shrink branch November 17, 2022 09:55
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.

None yet

2 participants