# APM java agent memory usage

**URL:** <https://discuss.elastic.co/t/apm-java-agent-memory-usage/243759>\
**Category:** APM\
**Tags:** java\
**Created:** [August 4, 2020, 5:51pm UTC](https://discuss.elastic.co/t/apm-java-agent-memory-usage/243759 "2020-08-04T17:51:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_Etemad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammad_etemad/32/42444_2.png) [@Mohammad\_Etemad](https://discuss.elastic.co/u/Mohammad_Etemad)\
**Post date:** [August 4, 2020, 5:51pm UTC](https://discuss.elastic.co/t/apm-java-agent-memory-usage/243759/1 "2020-08-04T17:51:37Z")

</div>

Hi All,

Is there a way to monitor and limit memory usage for the java apm agent? I believe this agent is making my java app to run out of memory.

Using:

apm java agent version: 1.16.0  
apm-server: 7.8

Thanks

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [August 5, 2020, 4:08am UTC](https://discuss.elastic.co/t/apm-java-agent-memory-usage/243759/2 "2020-08-05T04:08:04Z")

</div>

Hi 👋

If you are using gRPC, you should upgrade the agent at least to 1.17.0 where a related memory leak [was fixed](https://github.com/elastic/apm-agent-java/pull/1196).

Measuring the agent overhead is best done by comparing same scenarios/load-tests with and without the agent. Let us know if you see something interesting.

Regarding limiting the agent - there is no memory quota to apply, but you can use the [circuit breaker](https://www.elastic.co/guide/en/apm/agent/java/current/config-circuit-breaker.html#config-circuit-breaker) to make sure the agent disables itself if the JVM gets into a heap stress.

In addition, go over the [tuning and overhead page](https://www.elastic.co/guide/en/apm/agent/java/current/tuning-and-overhead.html#tuning-and-overhead) to get an idea of what's causing it. If you are using non-default agent configurations, try disabling them to see if there is any specific one related.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 26, 2020, 12:08am UTC](https://discuss.elastic.co/t/apm-java-agent-memory-usage/243759/3 "2020-08-26T00:08:08Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
