https://issues.apache.org/bugzilla/show_bug.cgi?id=54990
--- Comment #7 from Roberto Contiero <[email protected]> --- Sorry, I didn't explain myself properly. It's obvious to me that s.getResponseData() returns a pointer to the data array, but returning a pointer to entire array, pw.write() allocates that space. I have reproduced the issue and I have attached some screenshots that explain my test. The jvm.jpg is my jmeter environment. The beforeReadStream.jpg shows the memory status before read the stream (on the right of the image you can see a Java VisualVM screenshot). When the stream has been readed, in the afterReadStream.jpg you can see that allocated memory is about 500MB. The w.toByteArray() instruction (see beforeReturnFromReadStream.jpg), at the end of the readResponse method of the class HTTPSamplerBase, requires as much memory (see afterReturnFromReadStream.jpg). Then, when I reach the pw.write(s.getResponseData()); line and execute it, I obtain an OutOfMemoryError (below, the stack trace from the beginning of the test): 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: Listeners will be started after enabling running version 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: To revert to the earlier behaviour, define jmeterengine.startlistenerslater=false 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 2013/05/19 10:53:45 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*) 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : simone 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group simone. 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: Thread will stop on error 2013/05/19 10:53:45 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 60 perThread 60000.0 delayedStart=false 2013/05/19 10:53:45 INFO - jmeter.threads.JMeterThread: jmeterthread.startearlier=true (see jmeter.properties) 2013/05/19 10:53:45 INFO - jmeter.threads.JMeterThread: Running PostProcessors in forward order 2013/05/19 10:53:45 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 2013/05/19 10:53:45 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started 2013/05/19 10:53:45 INFO - jmeter.threads.JMeterThread: Thread started: simone 1-1 2013/05/19 10:53:45 INFO - jmeter.protocol.http.sampler.HTTPHCAbstractImpl: Local host = dell 2013/05/19 10:53:45 INFO - jmeter.protocol.http.sampler.HTTPHC3Impl: HTTP request retry count = 1 2013/05/19 10:53:45 INFO - jmeter.util.JsseSSLManager: Using default SSL protocol: SSLv3 2013/05/19 10:53:45 INFO - jmeter.util.JsseSSLManager: SSL session context: per-thread 2013/05/19 10:53:45 INFO - jmeter.util.SSLManager: JmeterKeyStore Location: type JKS 2013/05/19 10:53:45 INFO - jmeter.util.SSLManager: KeyStore created OK 2013/05/19 10:53:45 WARN - jmeter.util.SSLManager: Keystore file not found, loading empty keystore 2013/05/19 11:03:30 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(Unknown Source) at org.apache.jmeter.reporters.ResultSaver.saveSample(ResultSaver.java:189) at org.apache.jmeter.reporters.ResultSaver.processSample(ResultSaver.java:150) at org.apache.jmeter.reporters.ResultSaver.sampleOccurred(ResultSaver.java:140) at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:84) at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:783) at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:442) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) at java.lang.Thread.run(Unknown Source) 2013/05/19 11:03:30 INFO - jmeter.threads.JMeterThread: Thread finished: simone 1-1 2013/05/19 11:03:30 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 2013/05/19 11:03:30 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*) -- You are receiving this mail because: You are the assignee for the bug.
