branch-4.1: [opt](memory) release packed file writer buffer after flush #63967#63989
Merged
Conversation
### What problem does this PR solve? PackedFileWriter buffers data for files smaller than small_file_threshold_bytes before deciding whether to pack them into a packed file or switch to direct write. The buffered data is stored in a std::string. After the buffered data is flushed to the inner writer or submitted to PackedFileManager, the old code only called clear(), which resets size but keeps capacity. When segment file writers are still retained by upper-level rowset structures after close, this retained capacity can keep a large amount of memory alive and show up under PackedFileWriter::appendv in memory profiling: <img width="800" height="1180" alt="image" src="https://github.com/user-attachments/assets/7e0e2c40-c35b-4bfc-b45b-aeed31c29771" /> This change reserves the final append size before buffering to reduce repeated std::string growth, and releases the buffer capacity after the data has been flushed or submitted.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
yiguolei
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #63967