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 via email to