<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynatrace + OkHttp3 memory leak in Dynatrace tips</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-tips/Dynatrace-OkHttp3-memory-leak/m-p/282058#M1857</link>
    <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/93331"&gt;@tmay&lt;/a&gt;&amp;nbsp;Thank you very much for providing the feedback and solution!&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jul 2025 13:31:03 GMT</pubDate>
    <dc:creator>AgataWlodarczyk</dc:creator>
    <dc:date>2025-07-22T13:31:03Z</dc:date>
    <item>
      <title>Dynatrace + OkHttp3 memory leak</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/Dynatrace-OkHttp3-memory-leak/m-p/281514#M1856</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We believe we've stumbled on a memory leak caused by the Dynatrace default interceptor.&lt;/P&gt;
&lt;P&gt;We observed applications mysteriously restarting due to OOMs. Upon further investigation (jemalloc tuning), it was revealed that the native memory allocator from the Dynatrace native lib was hoarding twice our heap in memory.&lt;/P&gt;
&lt;P&gt;Here's a picture of the relevant allocation stack showing this.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tmay_0-1752511446527.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/29003iC2150AA98C71F68B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tmay_0-1752511446527.png" alt="tmay_0-1752511446527.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And because I'm sure it's useful, here's the one agent version information in a copy/pasteable form&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/opt/dynatrace/oneagent-paas/agent/bin/1.315.68.20250627-182234/linux-x86-64/liboneagentjava.so&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;We've observed that switching to a non-OkHttpClient client fixes this problem.&lt;/P&gt;
&lt;P&gt;Here's another shot of one of the paths taken&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tmay_1-1752511682761.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/29004i6C4F071D75214F3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tmay_1-1752511682761.png" alt="tmay_1-1752511682761.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It appears that memory allocated by `CorrelationNative` isn't being properly (or timely) released for the OkHttp integration.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 13:30:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/Dynatrace-OkHttp3-memory-leak/m-p/281514#M1856</guid>
      <dc:creator>tmay</dc:creator>
      <dc:date>2025-07-22T13:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynatrace + OkHttp3 memory leak</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/Dynatrace-OkHttp3-memory-leak/m-p/282058#M1857</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/93331"&gt;@tmay&lt;/a&gt;&amp;nbsp;Thank you very much for providing the feedback and solution!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 13:31:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/Dynatrace-OkHttp3-memory-leak/m-p/282058#M1857</guid>
      <dc:creator>AgataWlodarczyk</dc:creator>
      <dc:date>2025-07-22T13:31:03Z</dc:date>
    </item>
  </channel>
</rss>

