Igor Simjanoski - 2010-09-28

Hi, i'm experiencing Out Of Memory error when executing my test via
JSystem.Stack trace is the following:

Exception in thread "pool-1-thread-9" java.lang.OutOfMemoryError: Java heap
space

at java.util.Arrays.copyOf(Arrays.java:2786)

at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)

at java.io.PrintStream.write(PrintStream.java:430)

at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)

at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)

at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)

at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)

at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)

at java.io.PrintStream.write(PrintStream.java:476)

at java.io.PrintStream.print(PrintStream.java:619)

at com.aqua.anttask.jsystem.JUnitTestRunner.handleOutput(JUnitTestRunner.java:
595)

at com.aqua.anttask.jsystem.JSystemTask.handleOutput(JSystemTask.java:1221)

..............................................................................
..............................................................................
...........................

Test that i'm executing is following: i'm creating fixed size thread pool
executor(core size = max size = 10) and this pool execute tasks from queue. In
this queue i'm submitting ~50 000 Runnable objects. Each of this object is
simply executing GetMethod using HTTPClient. However, when test execution
starts and thread pool start to work i see that memory being used is keep
increasing until i got out of memory error. Increasing heap size (using
test.vm) didn't help, it only postponed the problem.

But, when i execute same piece of code without JSystem(i have created
executable JAR) i don't see any memory issue at all. I'm submitting almost 300
000 Runnable objects in the queue without any problems.

In stack trace i see only 2 JSystem related classes. I read JavaDoc of
JSystemTask.handleOutput() but didn't understand much. Can someone explain me
what this method does? Please note that Jsystem is started without GUI(using
runScenario.sh).