gh-150662: Stop unbounded memory growth in Tachyon --gecko collector#150845
Open
maurycy wants to merge 5 commits into
Open
gh-150662: Stop unbounded memory growth in Tachyon --gecko collector#150845maurycy wants to merge 5 commits into
--gecko collector#150845maurycy wants to merge 5 commits into
Conversation
maurycy
commented
Jun 3, 2026
| yield chunk | ||
|
|
||
|
|
||
| class NDJSONSpillColumn: |
Contributor
Author
There was a problem hiding this comment.
The story here is that I started with TypedSpillColumn, as in the idea from gh-150662, but array is not really a great fit for opcode markers, if we don't to maintain a separate serialization layer.
Reusing NDJSON name to avoid confusion with the --jsonl collector.
I think the best call would be to have only SpillColumn without array. It would massively simplify GeckoThreadSpill, but at the expense of 2-3 higher disk usage.
| "processType": thread_data["processType"], | ||
| "processName": thread_data["processName"], | ||
| } | ||
| file.write("{") |
Contributor
Author
There was a problem hiding this comment.
json would suck the file back into memory.
maurycy
commented
Jun 3, 2026
| self._prepare_for_serialization() | ||
| file = io.StringIO() | ||
| self._stream_profile(file) | ||
| return json.loads(file.getvalue()) |
Contributor
Author
There was a problem hiding this comment.
_build_profile() is now a test helper. Maybe we should move it to tests?
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.
The PR fixes an unbounded memory growth caused by:
cpython/Lib/profiling/sampling/gecko_collector.py
Lines 267 to 270 in 350e9de
It was reported in gh-150662 and the detailed idea for the fix by @pablogsal:
#150662 (comment)
Discussion
I don't think others collector have this issue.
pstats,collapsed/flamegraph,heatmap,jsonlshould just plateau. I've reviewed them. I pondered this for a day, and I don't think there's a better fix? It's not really crash-resillent safe. It likely doesn't matter here that much, as I'm really not sold on using Gecko for really long term profiling. Binary format is much better in this regard, and I've started experimenting with a different fix there. Perhaps we should encourage recording binary pattern more? The tests stay as is.(No longer) Reproduction