Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.OutOfMemoryError #151

Open
mgmanikandan87 opened this issue Nov 20, 2013 · 7 comments
Open

java.lang.OutOfMemoryError #151

mgmanikandan87 opened this issue Nov 20, 2013 · 7 comments
Labels

Comments

@mgmanikandan87
Copy link

I am getting out of memory error while taking screenshot more than 10 .

please let know why it happen.

Testing environment : Samsung galaxy note with no sdcard

@JakeWharton
Copy link
Member

On the device? On the computer? Stacktrace?

@ijunes
Copy link

ijunes commented Sep 2, 2014

In my case, the device seems to be affected. Test execution slows drown drastically, entry into a Textview is done around 1 character every 10 seconds

@ijunes
Copy link

ijunes commented Sep 3, 2014

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
at java.lang.StringCoding.decode(StringCoding.java:193)
at java.lang.String.(String.java:416)
at com.android.ddmlib.MultiLineReceiver.addOutput(MultiLineReceiver.java:55)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:441)
at com.android.ddmlib.Device.executeShellCommand(Device.java:602)
at com.android.ddmlib.testrunner.RemoteAndroidTestRunner.run(RemoteAndroidTestRunner.java:219)
at com.android.ddmlib.testrunner.RemoteAndroidTestRunner.run(RemoteAndroidTestRunner.java:204)
at com.squareup.spoon.SpoonDeviceRunner.run(SpoonDeviceRunner.java:201)
at com.squareup.spoon.SpoonRunner.runTests(SpoonRunner.java:130)
at com.squareup.spoon.SpoonRunner.run(SpoonRunner.java:92)
at com.squareup.spoon.SpoonRunner.main(SpoonRunner.java:453)
Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space
at com.android.ddmlib.MultiLineReceiver.addOutput(MultiLineReceiver.java:64)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:441)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:347)
at com.android.ddmlib.Device.executeShellCommand(Device.java:593)
at com.android.ddmlib.logcat.LogCatReceiverTask.run(LogCatReceiverTask.java:75)
at java.lang.Thread.run(Thread.java:745)

@JakeWharton
Copy link
Member

We buffer logs. If you have long tests with a ton of tests it'll eventually
run out.
On Sep 2, 2014 8:41 PM, "Junu Kang" notifications@github.com wrote:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
at java.lang.StringCoding.decode(StringCoding.java:193)
at java.lang.String.(String.java:416)
at
com.android.ddmlib.MultiLineReceiver.addOutput(MultiLineReceiver.java:55)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:441)
at com.android.ddmlib.Device.executeShellCommand(Device.java:602)
at
com.android.ddmlib.testrunner.RemoteAndroidTestRunner.run(RemoteAndroidTestRunner.java:219)
at
com.android.ddmlib.testrunner.RemoteAndroidTestRunner.run(RemoteAndroidTestRunner.java:204)
at com.squareup.spoon.SpoonDeviceRunner.run(SpoonDeviceRunner.java:201)
at com.squareup.spoon.SpoonRunner.runTests(SpoonRunner.java:130)
at com.squareup.spoon.SpoonRunner.run(SpoonRunner.java:92)
at com.squareup.spoon.SpoonRunner.main(SpoonRunner.java:453)
Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space
at
com.android.ddmlib.MultiLineReceiver.addOutput(MultiLineReceiver.java:64)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:441)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:347)
at com.android.ddmlib.Device.executeShellCommand(Device.java:593)
at
com.android.ddmlib.logcat.LogCatReceiverTask.run(LogCatReceiverTask.java:75)
at java.lang.Thread.run(Thread.java:745)


Reply to this email directly or view it on GitHub
#151 (comment).

@ijunes
Copy link

ijunes commented Sep 3, 2014

Would it be a side effect then if the tests start slowing down over time? or is the fact that the execution is taking forever just piling up logcat?

@yogurtearl
Copy link

Also, this can also happen if you have LOTS of logcat output. Espresso can be fairly verbose.
Check the logs ( in verbose mode ) and see if there is anything that you don't need and can turn off.

#112 would allow you to allocate more memory.

@edenman edenman added the bug label Mar 16, 2015
@mathroule
Copy link

Same issue happening on device with many UI tests and taking a lot of screenshots. I'm using FalconSpoon wrapper to handle dialog screenshots.

Log from device:

16:14.699	info	TestRunner	----- begin exception -----
03-10 02:16:14.699	info	TestRunner	java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 4194304 free bytes and 7MB until OOM
03-10 02:16:14.699	info	TestRunner	at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
03-10 02:16:14.699	info	TestRunner	at android.graphics.Bitmap.nativeCreate(Native Method)
03-10 02:16:14.699	info	TestRunner	at android.graphics.Bitmap.createBitmap(Bitmap.java:812)
03-10 02:16:14.699	info	TestRunner	at android.graphics.Bitmap.createBitmap(Bitmap.java:789)
03-10 02:16:14.699	info	TestRunner	at android.graphics.Bitmap.createBitmap(Bitmap.java:756)
03-10 02:16:14.699	info	TestRunner	at com.squareup.spoon.Spoon.takeScreenshot(Spoon.java:100)
03-10 02:16:14.699	info	TestRunner	at com.squareup.spoon.Spoon.screenshot(Spoon.java:85)
03-10 02:16:14.699	info	TestRunner	at com.squareup.spoon.Spoon.screenshot(Spoon.java:62)
03-10 02:16:14.699	info	TestRunner	at com.jraska.falcon.FalconSpoon.screenshot(FalconSpoon.java:16)
03-10 02:16:14.699	info	TestRunner	at com.globalsport.pro.test.helpers.view.CustomViewAction.takeScreenshot(CustomViewAction.java:173)
03-10 02:16:14.699	info	TestRunner	at com.globalsport.pro.test.ui.RpeUiTest.do_not_display_training_session_without_questionnaire(RpeUiTest.java:101)
03-10 02:16:14.699	info	TestRunner	at java.lang.reflect.Method.invoke(Native Method)
03-10 02:16:14.699	info	TestRunner	at java.lang.reflect.Method.invoke(Method.java:372)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
03-10 02:16:14.699	info	TestRunner	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
03-10 02:16:14.699	info	TestRunner	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
03-10 02:16:14.699	info	TestRunner	at android.support.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:64)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.Suite.runChild(Suite.java:128)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.Suite.runChild(Suite.java:27)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
03-10 02:16:14.699	info	TestRunner	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
03-10 02:16:14.699	info	TestRunner	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
03-10 02:16:14.699	info	TestRunner	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
03-10 02:16:14.699	info	TestRunner	at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
03-10 02:16:14.699	info	TestRunner	at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:271)
03-10 02:16:14.699	info	TestRunner	at com.globalsport.pro.test.helpers.runner.MyCoachTestRunner.onStart(MyCoachTestRunner.java:17)
03-10 02:16:14.699	info	TestRunner	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
03-10 02:16:14.699	info	TestRunner	----- end exception -----

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants