Cleaning up memory used by an HTTPSampleResult

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cleaning up memory used by an HTTPSampleResult

Antony Bowesman
I've been investigating a memory leak and it seems that under certain circumstances when I get a redirect, I end up downloading a bunch of embedded resources I don't need. In this case, these HTTPSampleResult objects end up being part of my JavaSampler instance, which is added to the TEAR_DOWN_SET in the JavaSampler jmeter class.

In this particular test, the Java Sampler only executes once and so the HTTPSampleResult objects only get cleaned up at the end of the test, when my teardownTest() method is called. However, it also applies to samplers that are called in a OnceOnlyController, which in my case happens to be Login.

I have a couple of solutions, i.e. I know I can prevent the follow redirects to stop the symptoms of this behaviour and I can also put in a hack that will clean up the resources by other samplers in the same thread, but the bigger picture of how to prevent the basic memory leak issue that appears to exist for these hanging HTTPSampleResult objects. The main culprit is the responseData byte[], which basically holds the entire response payload.

There seems to be no message I can listen for (LoopIterationListener/TestIterationListener) to indicate a thread has made its last iteration.

Is there any way to clean up a thread's resources when it is done with. I can't do the cleanup during the iteration as there may be listeners that want the results.

Thanks
Antony

Reply | Threaded
Open this post in threaded view
|

RE: Cleaning up memory used by an HTTPSampleResult

Antony Bowesman
I was unnecessarily hanging on to these SampleResult objects, so have cleaned that up, but the question on how to know that the thread has made its last iteration still stands - any ideas or is this something for dev? It's version 3.3

> -----Original Message-----
> From: Antony Bowesman [mailto:[hidden email]]
> Sent: Tuesday, 3 April 2018 2:04 PM
> To: JMeter Users List <[hidden email]>
> Subject: Cleaning up memory used by an HTTPSampleResult
>
> I've been investigating a memory leak and it seems that under certain
> circumstances when I get a redirect, I end up downloading a bunch of
> embedded resources I don't need. In this case, these HTTPSampleResult
> objects end up being part of my JavaSampler instance, which is added to the
> TEAR_DOWN_SET in the JavaSampler jmeter class.
>
> In this particular test, the Java Sampler only executes once and so the
> HTTPSampleResult objects only get cleaned up at the end of the test, when
> my teardownTest() method is called. However, it also applies to samplers
> that are called in a OnceOnlyController, which in my case happens to be
> Login.
>
> I have a couple of solutions, i.e. I know I can prevent the follow redirects to
> stop the symptoms of this behaviour and I can also put in a hack that will
> clean up the resources by other samplers in the same thread, but the bigger
> picture of how to prevent the basic memory leak issue that appears to exist
> for these hanging HTTPSampleResult objects. The main culprit is the
> responseData byte[], which basically holds the entire response payload.
>
> There seems to be no message I can listen for
> (LoopIterationListener/TestIterationListener) to indicate a thread has made
> its last iteration.
>
> Is there any way to clean up a thread's resources when it is done with. I can't
> do the cleanup during the iteration as there may be listeners that want the
> results.
>
> Thanks
> Antony


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]