Skip to content

NONJAVACLI-4237 Fix memory leak in Producer.produce() when headers are provided and exceptions occur#2170

Merged
Kaushik Raina (k-raina) merged 2 commits intomasterfrom
kraina-fix-memory-leak-unfreed-headers
Jan 12, 2026
Merged

NONJAVACLI-4237 Fix memory leak in Producer.produce() when headers are provided and exceptions occur#2170
Kaushik Raina (k-raina) merged 2 commits intomasterfrom
kraina-fix-memory-leak-unfreed-headers

Conversation

@k-raina
Copy link
Copy Markdown
Member

@k-raina Kaushik Raina (k-raina) commented Jan 9, 2026

Summary

Fixes a memory leak in Producer.produce() that occurs when the method is called with a non-None headers parameter and raises BufferError (queue full) or RuntimeError (producer closed).

Fixes #2167

Problem

When Producer.produce() is called with headers and an error occurs, the allocated rd_headers memory is not freed before the function returns, causing a memory leak. This can be observed by repeatedly calling produce() with headers while the producer's queue is full or after closing the producer.

Root Cause

The Producer_produce() function allocates rd_headers via py_headers_to_c() at line 287. However, in two error paths, the function returns without freeing this memory:

  1. RuntimeError path (line 299-302): When producer is closed (!self->rk), the function returns early without freeing rd_headers
  2. BufferError path (line 326-333): When rd_kafka_producev() returns an error, the function cleans up msgstate but doesn't free rd_headers before returning

When rd_kafka_producev() returns an error, it doesn't take ownership of the headers, so they must be freed manually by the caller.

Solution

Added rd_kafka_headers_destroy(rd_headers) calls in both error paths before returning:

  1. Fix 1 (lines 300-303): Free rd_headers when producer is closed before raising RuntimeError
  2. Fix 2 (lines 329-332): Free rd_headers when Producer_producev() returns an error before raising BufferError or KafkaException

Testing

Reproduction Scripts

test_memory_leak_buffererror.py

Test Results

Before Fix:

  • RuntimeError: Memory increased by ~50 MB after 1,080,000 iterations
  • BufferError: Memory increased by ~50 MB after 640,000 iterations
  • Leak rate: ~46-78 bytes per failed call

After Fix:

  • RuntimeError: Memory increased by only 0.03 MB after 180,000+ iterations (stable)
  • BufferError: Memory stabilizes after initial queue fill (~25 MB, then stable)

Log

Before

➜  confluent-kafka-python git:(kraina-fix-memory-leak-unfreed-headers) ✗ PYTHONPATH=src:$PYTHONPATH python3 test_memory_leak_buffererror.py
Initial RSS: 16.55 MB
Iteration 0: RSS: 16.67 MB (increase: 0.12 MB)
%3|1767971345.003|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9200/bootstrap]: 127.0.0.1:9200/bootstrap: Connect to ipv4#127.0.0.1:9200 failed: Connection refused (after 0ms in state CONNECT)
Iteration 10,000: RSS: 19.16 MB (increase: 2.61 MB)
Iteration 20,000: RSS: 21.64 MB (increase: 5.09 MB)
Iteration 30,000: RSS: 24.09 MB (increase: 7.55 MB)
Iteration 40,000: RSS: 26.62 MB (increase: 10.08 MB)
Iteration 50,000: RSS: 29.12 MB (increase: 12.58 MB)
Iteration 60,000: RSS: 31.61 MB (increase: 15.06 MB)
Iteration 70,000: RSS: 34.06 MB (increase: 17.52 MB)
%3|1767971345.058|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9200/bootstrap]: 127.0.0.1:9200/bootstrap: Connect to ipv4#127.0.0.1:9200 failed: Connection refused (after 0ms in state CONNECT, 1 identical error(s) suppressed)
Iteration 80,000: RSS: 36.59 MB (increase: 20.05 MB)
Iteration 90,000: RSS: 39.08 MB (increase: 22.53 MB)
Iteration 100,000: RSS: 41.55 MB (increase: 25.00 MB)
Iteration 110,000: RSS: 42.03 MB (increase: 25.48 MB)
Iteration 120,000: RSS: 42.48 MB (increase: 25.94 MB)
Iteration 130,000: RSS: 42.94 MB (increase: 26.39 MB)
Iteration 140,000: RSS: 43.41 MB (increase: 26.86 MB)
Iteration 150,000: RSS: 43.88 MB (increase: 27.33 MB)
Iteration 160,000: RSS: 44.33 MB (increase: 27.78 MB)
Iteration 170,000: RSS: 44.80 MB (increase: 28.25 MB)
Iteration 180,000: RSS: 45.30 MB (increase: 28.75 MB)
Iteration 190,000: RSS: 45.75 MB (increase: 29.20 MB)
Iteration 200,000: RSS: 46.19 MB (increase: 29.64 MB)
Iteration 210,000: RSS: 46.67 MB (increase: 30.12 MB)
Iteration 220,000: RSS: 47.16 MB (increase: 30.61 MB)
Iteration 230,000: RSS: 47.61 MB (increase: 31.06 MB)
Iteration 240,000: RSS: 48.08 MB (increase: 31.53 MB)
Iteration 250,000: RSS: 48.52 MB (increase: 31.97 MB)
Iteration 260,000: RSS: 48.97 MB (increase: 32.42 MB)
Iteration 270,000: RSS: 49.47 MB (increase: 32.92 MB)
Iteration 280,000: RSS: 49.89 MB (increase: 33.34 MB)
Iteration 290,000: RSS: 50.38 MB (increase: 33.83 MB)
Iteration 300,000: RSS: 50.86 MB (increase: 34.31 MB)
Iteration 310,000: RSS: 51.34 MB (increase: 34.80 MB)
Iteration 320,000: RSS: 51.80 MB (increase: 35.25 MB)
Iteration 330,000: RSS: 52.25 MB (increase: 35.70 MB)
Iteration 340,000: RSS: 52.70 MB (increase: 36.16 MB)
Iteration 350,000: RSS: 53.17 MB (increase: 36.62 MB)
Iteration 360,000: RSS: 53.64 MB (increase: 37.09 MB)
Iteration 370,000: RSS: 54.14 MB (increase: 37.59 MB)
Iteration 380,000: RSS: 54.59 MB (increase: 38.05 MB)
Iteration 390,000: RSS: 55.05 MB (increase: 38.50 MB)
Iteration 400,000: RSS: 55.50 MB (increase: 38.95 MB)
Iteration 410,000: RSS: 55.97 MB (increase: 39.42 MB)
Iteration 420,000: RSS: 56.44 MB (increase: 39.89 MB)
Iteration 430,000: RSS: 56.95 MB (increase: 40.41 MB)
Iteration 440,000: RSS: 57.41 MB (increase: 40.86 MB)
Iteration 450,000: RSS: 57.86 MB (increase: 41.31 MB)
Iteration 460,000: RSS: 58.30 MB (increase: 41.75 MB)
Iteration 470,000: RSS: 58.77 MB (increase: 42.22 MB)
Iteration 480,000: RSS: 59.22 MB (increase: 42.67 MB)
Iteration 490,000: RSS: 59.69 MB (increase: 43.14 MB)
Iteration 500,000: RSS: 60.17 MB (increase: 43.62 MB)
Iteration 510,000: RSS: 60.64 MB (increase: 44.09 MB)
Iteration 520,000: RSS: 61.09 MB (increase: 44.55 MB)
Iteration 530,000: RSS: 61.55 MB (increase: 45.00 MB)
Iteration 540,000: RSS: 62.02 MB (increase: 45.47 MB)
Iteration 550,000: RSS: 62.47 MB (increase: 45.92 MB)
Iteration 560,000: RSS: 62.95 MB (increase: 46.41 MB)
Iteration 570,000: RSS: 63.45 MB (increase: 46.91 MB)
Iteration 580,000: RSS: 63.92 MB (increase: 47.38 MB)
Iteration 590,000: RSS: 64.38 MB (increase: 47.83 MB)
Iteration 600,000: RSS: 64.83 MB (increase: 48.28 MB)
Iteration 610,000: RSS: 65.30 MB (increase: 48.75 MB)
Iteration 620,000: RSS: 65.77 MB (increase: 49.22 MB)
Iteration 630,000: RSS: 66.22 MB (increase: 49.67 MB)
Iteration 640,000: RSS: 66.67 MB (increase: 50.12 MB)
Memory leak detected! Memory increased by 50.12 MB after 640,000 iterations.
%4|1767971345.641|TERMINATE|rdkafka#producer-1| [thrd:app]: Producer terminating with 100000 messages (1100000 bytes) still in queue or transit: use flush() to wait for outstanding message delivery

After

➜  confluent-kafka-python git:(kraina-fix-memory-leak-unfreed-headers) ✗ PYTHONPATH=src:$PYTHONPATH python3 test_memory_leak_buffererror.py
Initial RSS: 16.42 MB
Iteration 0: RSS: 16.53 MB (increase: 0.11 MB)
%3|1767971571.978|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9200/bootstrap]: 127.0.0.1:9200/bootstrap: Connect to ipv4#127.0.0.1:9200 failed: Connection refused (after 0ms in state CONNECT)
Iteration 10,000: RSS: 19.06 MB (increase: 2.64 MB)
Iteration 20,000: RSS: 21.55 MB (increase: 5.12 MB)
Iteration 30,000: RSS: 24.05 MB (increase: 7.62 MB)
Iteration 40,000: RSS: 26.55 MB (increase: 10.12 MB)
Iteration 50,000: RSS: 29.03 MB (increase: 12.61 MB)
Iteration 60,000: RSS: 31.48 MB (increase: 15.06 MB)
Iteration 70,000: RSS: 33.97 MB (increase: 17.55 MB)
%3|1767971572.031|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9200/bootstrap]: 127.0.0.1:9200/bootstrap: Connect to ipv4#127.0.0.1:9200 failed: Connection refused (after 0ms in state CONNECT, 1 identical error(s) suppressed)
Iteration 80,000: RSS: 36.41 MB (increase: 19.98 MB)
Iteration 90,000: RSS: 38.89 MB (increase: 22.47 MB)
Iteration 100,000: RSS: 41.38 MB (increase: 24.95 MB)
Iteration 110,000: RSS: 41.38 MB (increase: 24.95 MB)
Iteration 120,000: RSS: 41.38 MB (increase: 24.95 MB)
Iteration 130,000: RSS: 41.38 MB (increase: 24.95 MB)
Iteration 140,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 150,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 160,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 170,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 180,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 190,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 200,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 210,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 220,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 230,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 240,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 250,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 260,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 270,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 280,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 290,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 300,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 310,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 320,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 330,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 340,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 350,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 360,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 370,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 380,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 390,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 400,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 410,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 420,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 430,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 440,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 450,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 460,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 470,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 480,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 490,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 500,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 510,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 520,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 530,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 540,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 550,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 560,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 570,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 580,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 590,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 600,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 610,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 620,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 630,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 640,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 650,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 660,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 670,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 680,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 690,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 700,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 710,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 720,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 730,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 740,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 750,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 760,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 770,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 780,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 790,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 800,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 810,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 820,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 830,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 840,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 850,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 860,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 870,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 880,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 890,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 900,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 910,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 920,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 930,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 940,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 950,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 960,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 970,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 980,000: RSS: 41.41 MB (increase: 24.98 MB)
Iteration 990,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,000,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,010,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,020,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,030,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,040,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,050,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,060,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,070,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,080,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,090,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,100,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,110,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,120,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,130,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,140,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,150,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,160,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,170,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,180,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,190,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,200,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,210,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,220,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,230,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,240,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,250,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,260,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,270,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,280,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,290,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,300,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,310,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,320,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,330,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,340,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,350,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,360,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,370,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,380,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,390,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,400,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,410,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,420,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,430,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,440,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,450,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,460,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,470,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,480,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,490,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,500,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,510,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,520,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,530,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,540,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,550,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,560,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,570,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,580,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,590,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,600,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,610,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,620,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,630,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,640,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,650,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,660,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,670,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,680,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,690,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,700,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,710,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,720,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,730,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,740,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,750,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,760,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,770,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,780,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,790,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,800,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,810,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,820,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,830,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,840,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,850,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,860,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,870,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,880,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,890,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,900,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,910,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,920,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,930,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,940,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,950,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,960,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,970,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,980,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 1,990,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,000,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,010,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,020,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,030,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,040,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,050,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,060,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,070,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,080,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,090,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,100,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,110,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,120,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,130,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,140,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,150,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,160,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,170,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,180,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,190,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,200,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,210,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,220,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,230,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,240,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,250,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,260,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,270,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,280,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,290,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,300,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,310,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,320,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,330,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,340,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,350,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,360,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,370,000: RSS: 41.42 MB (increase: 25.00 MB)
Iteration 2,380,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,390,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,400,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,410,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,420,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,430,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,440,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,450,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,460,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,470,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,480,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,490,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,500,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,510,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,520,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,530,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,540,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,550,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,560,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,570,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,580,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,590,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,600,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,610,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,620,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,630,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,640,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,650,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,660,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,670,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,680,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,690,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,700,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,710,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,720,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,730,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,740,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,750,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,760,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,770,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,780,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,790,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,800,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,810,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,820,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,830,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,840,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,850,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,860,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,870,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,880,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,890,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,900,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,910,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,920,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,930,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,940,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,950,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,960,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,970,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,980,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 2,990,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,000,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,010,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,020,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,030,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,040,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,050,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,060,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,070,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,080,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,090,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,100,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,110,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,120,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,130,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,140,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,150,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,160,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,170,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,180,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,190,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,200,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,210,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,220,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,230,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,240,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,250,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,260,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,270,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,280,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,290,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,300,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,310,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,320,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,330,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,340,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,350,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,360,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,370,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,380,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,390,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,400,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,410,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,420,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,430,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,440,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,450,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,460,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,470,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,480,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,490,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,500,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,510,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,520,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,530,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,540,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,550,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,560,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,570,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,580,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,590,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,600,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,610,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,620,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,630,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,640,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,650,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,660,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,670,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,680,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,690,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,700,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,710,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,720,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,730,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,740,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,750,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,760,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,770,000: RSS: 41.45 MB (increase: 25.03 MB)
Iteration 3,780,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,790,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,800,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,810,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,820,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,830,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,840,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,850,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,860,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,870,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,880,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,890,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,900,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,910,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,920,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,930,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,940,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,950,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,960,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,970,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,980,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 3,990,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,000,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,010,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,020,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,030,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,040,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,050,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,060,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,070,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,080,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,090,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,100,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,110,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,120,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,130,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,140,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,150,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,160,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,170,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,180,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,190,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,200,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,210,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,220,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,230,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,240,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,250,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,260,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,270,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,280,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,290,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,300,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,310,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,320,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,330,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,340,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,350,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,360,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,370,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,380,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,390,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,400,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,410,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,420,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,430,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,440,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,450,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,460,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,470,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,480,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,490,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,500,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,510,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,520,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,530,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,540,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,550,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,560,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,570,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,580,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,590,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,600,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,610,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,620,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,630,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,640,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,650,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,660,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,670,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,680,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,690,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,700,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,710,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,720,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,730,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,740,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,750,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,760,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,770,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,780,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,790,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,800,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,810,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,820,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,830,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,840,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,850,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,860,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,870,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,880,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,890,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,900,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,910,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,920,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,930,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,940,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,950,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,960,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,970,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,980,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 4,990,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,000,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,010,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,020,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,030,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,040,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,050,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,060,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,070,000: RSS: 41.47 MB (increase: 25.05 MB)
Iteration 5,080,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,090,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,100,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,110,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,120,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,130,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,140,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,150,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,160,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,170,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,180,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,190,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,200,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,210,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,220,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,230,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,240,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,250,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,260,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,270,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,280,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,290,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,300,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,310,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,320,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,330,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,340,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,350,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,360,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,370,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,380,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,390,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,400,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,410,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,420,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,430,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,440,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,450,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,460,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,470,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,480,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,490,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,500,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,510,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,520,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,530,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,540,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,550,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,560,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,570,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,580,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,590,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,600,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,610,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,620,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,630,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,640,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,650,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,660,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,670,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,680,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,690,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,700,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,710,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,720,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,730,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,740,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,750,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,760,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,770,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,780,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,790,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,800,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,810,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,820,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,830,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,840,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,850,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,860,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,870,000: RSS: 41.48 MB (increase: 25.06 MB)
Iteration 5,880,000: RSS: 41.48 MB (increase: 25.06 MB)
^CTraceback (most recent call last):
  File "/Users/kaushikraina/projects/njc/confluent-kafka-python/test_memory_leak_buffererror.py", line -1, in <module>
KeyboardInterrupt
%4|1767971578.234|TERMINATE|rdkafka#producer-1| [thrd:app]: Producer terminating with 100000 messages (1100000 bytes) still in queue or transit: use flush() to wait for outstanding message delivery

References

Copilot AI review requested due to automatic review settings January 9, 2026 08:35
@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a memory leak in Producer.produce() that occurs when headers are provided and the method raises an exception (either BufferError when the queue is full, or RuntimeError when the producer is closed). The leak was caused by allocated header memory not being freed before returning from these error paths.

Key Changes

  • Added rd_kafka_headers_destroy() calls in two error paths within Producer.produce() to properly free allocated headers before raising exceptions
  • Both fixes are properly guarded with #ifdef RD_KAFKA_V_HEADERS to maintain compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pranavrth
Copy link
Copy Markdown
Member

Build is failing. Maybe a transient error. Reran.

@pranavrth
Copy link
Copy Markdown
Member

Pranav Rathi (pranavrth) commented Jan 9, 2026

Looks fine. Please add CHANGELOG.

@pranavrth
Copy link
Copy Markdown
Member

Can you reproduce the issue and add valgrind logs to confirm that we are not hitting memory leak anymore?

@pranavrth
Copy link
Copy Markdown
Member

Please fix the following

  • Build is failing
  • Rebase the PR

@airlock-confluentinc airlock-confluentinc Bot force-pushed the kraina-fix-memory-leak-unfreed-headers branch from 19b654e to 41d0fc7 Compare January 12, 2026 14:00
@sonarqube-confluent
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@pranavrth Pranav Rathi (pranavrth) left a comment

Choose a reason for hiding this comment

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

LGTM!.

@k-raina Kaushik Raina (k-raina) changed the title Fix memory leak in Producer.produce() when headers are provided and exceptions occur NONJAVACLI-4237 Fix memory leak in Producer.produce() when headers are provided and exceptions occur Jan 12, 2026
@k-raina Kaushik Raina (k-raina) merged commit 78394e5 into master Jan 12, 2026
3 checks passed
@k-raina Kaushik Raina (k-raina) deleted the kraina-fix-memory-leak-unfreed-headers branch January 12, 2026 16:27
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.

Memory leak when produce is called with headers and raises exception

3 participants