Skip to content

Commit 3e71061

Browse files
committed
Cap RLE batch size to bound the per-batch timestamp list
1 parent beb5980 commit 3e71061

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_remote_debugging/binary_io_reader.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
/* Progress callback frequency */
2929
#define PROGRESS_CALLBACK_INTERVAL 1000
30+
#define MAX_RLE_BATCH_SAMPLES 8192 /* Cap per-batch samples to bound the timestamp list (gh-152089) */
3031

3132
/* ============================================================================
3233
* BINARY READER IMPLEMENTATION
@@ -1095,7 +1096,8 @@ binary_reader_replay(BinaryReader *reader, PyObject *collector, PyObject *progre
10951096
ts->prev_timestamp += delta;
10961097

10971098
/* Start new batch on first sample or status change */
1098-
if (i == 0 || status != batch_status) {
1099+
if (i == 0 || status != batch_status
1100+
|| batch_idx >= MAX_RLE_BATCH_SAMPLES) {
10991101
if (timestamps_list) {
11001102
int rc = emit_batch(state, collector, thread_id, interpreter_id,
11011103
batch_status, ts->current_stack, ts->current_stack_depth,

0 commit comments

Comments
 (0)