# Dropping ResponseBody bytes

**URL:** <https://community.gatling.io/t/dropping-responsebody-bytes/5828>\
**Category:** Gatling (Open-Source)\
**Created:** [October 4, 2020, 11:57pm UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828 "2020-10-04T23:57:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Houghton](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nick\_Houghton](https://community.gatling.io/u/Nick_Houghton)\
**Post date:** [October 4, 2020, 11:57pm UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/1 "2020-10-04T23:57:48Z")

</div>

Using Gatling 3.4.0 (latest) and trying to test a concurrent HTTP GET retrieving part of a large binary file (via Range request headers). I want to test 500+ concurrent requests for 1/10/100MB segments, but tests over 1MB segment size fail with OutOfMemory / Netty cannot allocate direct memory errors.

Looking through the Gatling code it appears to be caused by the way Gatling builds up the Response and ResponseBody objects, and even though I never want to introspect the response body bytes they are kept for the life of the request/response pair (and thrown away after checks etc by GC). It seems like ‘transformResponse’ exists to help customise the Response and ResponseBody and could help, but in this case that is too late as the tests run out of memory just building up the Response itself before ‘transform…’ is called.

I’m looking for an options/configuration to disable this behaviour, effectively tell Gatling “throw away the response body bytes when received for this request”, does such an option exist? Without it it seems like i’m stuck having to use some other framework for tests that result in large binary responses vs tests that receive smaller payloads.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [October 5, 2020, 5:49am UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/2 "2020-10-05T05:49:52Z")

</div>

No, Gatling only buffers the change chunks in memory if necessary:

[https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/engine/GatlingHttpListener.scala#L140](https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/engine/GatlingHttpListener.scala#L140)

• if resources inferring is enabled and content-type is HTML  
• if you’re explicitly doing something with the response body (checks, tranformers, debug): [https://github.com/gatling/gatling/blob/738c10621833f23b43ce6030df54566134a8ac94/gatling-http/src/main/scala/io/gatling/http/request/builder/HttpRequestBuilder.scala#L170](https://github.com/gatling/gatling/blob/738c10621833f23b43ce6030df54566134a8ac94/gatling-http/src/main/scala/io/gatling/http/request/builder/HttpRequestBuilder.scala#L170)

---

<div class="post-metadata">

**Author:** ![Nick\_Houghton](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nick\_Houghton](https://community.gatling.io/u/Nick_Houghton)\
**Post date:** [October 5, 2020, 6:00am UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/3 "2020-10-05T06:00:35Z")

</div>

Ok thats good news, must be something in my particular setup then. I did have http debugging on but turned it off I thought.

I’ll step through with the debugger and triple check those flags. Thanks!

---

<div class="post-metadata">

**Author:** ![Nick\_Houghton](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nick\_Houghton](https://community.gatling.io/u/Nick_Houghton)\
**Post date:** [October 5, 2020, 10:03am UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/4 "2020-10-05T10:03:12Z")

</div>

Ah ok i’m bumping into this - [https://github.com/gatling/gatling/issues/3783](https://github.com/gatling/gatling/issues/3783)

Can’t make parallel resources without using .resources() and using .resources() causes http response body processing it seems.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [October 5, 2020, 10:07am UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/5 "2020-10-05T10:07:23Z")

</div>

Sorry, I don’t see how this is related to the title/topic of this thread.

---

<div class="post-metadata">

**Author:** ![Nick\_Houghton](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nick\_Houghton](https://community.gatling.io/u/Nick_Houghton)\
**Post date:** [October 5, 2020, 10:21am UTC](https://community.gatling.io/t/dropping-responsebody-bytes/5828/6 "2020-10-05T10:21:14Z")

</div>

I’ve been trying to find why gatling is keeping the response body chunks, and I thought it was because of .resources() and thus the issue, but apparently not… i’ll keep digging
