damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.42k stars 803 forks source link

Memory leak #172

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:28

Archos 5 Internet Tablet Android 1.6

Force close after repeatedly running and editing a good script and after 
repeatedly switching between SL4A and other applications. The behavior suggests 
to me that there is s memory leak and while trying to learn about contexts I 
found this which might describe the problem:

  <http://developer.android.com/resources/articles/avoiding-memory-leaks.html>

Frank

Original issue reported on code.google.com by frank.we...@gmail.com on 21 Jan 2011 at 5:14

Copied from original issue: damonkohler/android-scripting#509

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:28

I am noticing similar behavior on an ADP1 running Android 1.5.

Steps to reproduce:
1) Run script.py in background
2) Tap ongoing-notification to bring up list of running scripts
3) Select script.py.
4) Tap the ongoing-notification again.
5) If script.py is still running, GOTO 3.  Else, GOTO 6.
6) Check logcat; note out-of-memory messages, "Process 
com.googlecode.android_scripting (pid) has died" message.

You may have to repeat steps 3-4 a few times.  I've seen the crash after as 
many as 10 repeats or as few as 4.  The script I used to test this essentially 
does nothing; it opens a loopback socket and listens forever for connections.

See also attached logcat output.

Original comment by brett.hi...@gmail.com on 3 Feb 2011 at 8:47

Attachments:

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:28

I typically have an HTTP server and a mail user agent (SMTP, POP3, NNTP) 
running in Rhino. I wonder if this problem is related to sockets. I use the 
Java API for sockets.

Frank

Original comment by frank.we...@gmail.com on 4 Feb 2011 at 3:03

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:28

I'm pretty sure it's nothing to do with sockets.  Doing the above steps while 
running the following script will also reproduce the crash, though it takes 
more switches before it crashes:

import time
while True:
    time.sleep(3600)

Original comment by brett.hi...@gmail.com on 14 Feb 2011 at 2:57

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:28

I agree that it probably isn't related to sockets.

Now that I can get logcat reports one is included below. This Archos 5 doesn't 
permit file upload.

I'm having to trim a great amount from this data to get the issue manager to 
accept it. I hope that what remains is useful.

Frank

E/dalvikvm-heap( 7067): 756480-byte external allocation too large for this 
process.
E/        ( 7067): VM won't let us allocate 756480 bytes
D/AndroidRuntime( 7067): Shutting down VM
W/dalvikvm( 7067): threadid=3: thread exiting with uncaught exception 
(group=0x4001aa38)
E/AndroidRuntime( 7067): Uncaught handler: thread main exiting due to uncaught 
exception
E/AndroidRuntime( 7067): java.lang.OutOfMemoryError: bitmap size exceeds VM 
budget
E/AndroidRuntime( 7067):    at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime( 7067):    at 
android.graphics.Bitmap.createBitmap(Bitmap.java:468)
E/AndroidRuntime( 7067):    at 
org.connectbot.service.TerminalBridge.parentChanged(TerminalBridge.java:498)
E/AndroidRuntime( 7067):    at 
org.connectbot.TerminalView.onSizeChanged(TerminalView.java:125)
E/AndroidRuntime( 7067):    at android.view.View.setFrame(View.java:6636)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6563)
E/AndroidRuntime( 7067):    at 
android.widget.RelativeLayout.onLayout(RelativeLayout.java:900)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6569)
E/AndroidRuntime( 7067):    at 
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6569)
E/AndroidRuntime( 7067):    at 
android.widget.RelativeLayout.onLayout(RelativeLayout.java:900)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6569)
E/AndroidRuntime( 7067):    at 
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6569)
E/AndroidRuntime( 7067):    at 
android.widget.FrameLayout.onLayout(FrameLayout.java:333)
E/AndroidRuntime( 7067):    at android.view.View.layout(View.java:6569)
E/AndroidRuntime( 7067):    at 
android.view.ViewRoot.performTraversals(ViewRoot.java:984)
E/AndroidRuntime( 7067):    at 
android.view.ViewRoot.handleMessage(ViewRoot.java:1619)
E/AndroidRuntime( 7067):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7067):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 7067):    at 
android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime( 7067):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 7067):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 7067):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 7067):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime( 7067):    at dalvik.system.NativeStart.main(Native Method)
I/Process ( 1457): Sending signal. PID: 7067 SIG: 3
I/dalvikvm( 7067): threadid=7: reacting to signal 3
I/dalvikvm( 7067): Wrote stack trace to '/data/anr/traces.txt'
D/dalvikvm( 7756): Trying to load lib /system/lib/libandroid_runtime.so 0x0
D/dalvikvm( 7756): Added shared lib /system/lib/libandroid_runtime.so 0x0
D/dalvikvm( 7756): No JNI_OnLoad found in /system/lib/libandroid_runtime.so 0x0
D/FmSystem( 7756): register_android_media_FmRadioService
I/Process ( 7067): Sending signal. PID: 7067 SIG: 9
I/ActivityManager( 1457): Process com.googlecode.android_scripting (pid 7067) 
has died.
W/ActivityManager( 1457): Scheduling restart of crashed service 
com.googlecode.android_scripting/.activity.ScriptingLayerService in 5000ms
I/WindowManager( 1457): WIN DEATH: Window{45eb6da8 Toast paused=false}
I/WindowManager( 1457): WIN DEATH: Window{45f13b40 
com.googlecode.android_scripting/com.googlecode.android_scripting.activity.Scrip
tManager paused=false}
I/WindowManager( 1457): WIN DEATH: Window{45f58408 
com.googlecode.android_scripting/com.googlecode.android_scripting.activity.Scrip
tEditor paused=false}
I/WindowManager( 1457): WIN DEATH: Window{45fcc980 
com.googlecode.android_scripting/org.connectbot.ConsoleActivity paused=false}
I/ActivityManager( 1457): Start proc com.googlecode.android_scripting for 
activity com.googlecode.android_scripting/.activity.ScriptManager: pid=7763 
uid=10018 gids={3003, 1015, 1007, 3002, 3001, 1006}
E/ActivityThread( 1457): Failed to find provider info for android.server.checkin
W/Checkin ( 1457): Can't log event SYSTEM_SERVICE_LOOPING: 
java.lang.IllegalArgumentException: Unknown URL 
content://android.server.checkin/events
W/UsageStats( 1457): Something wrong here, didn't expect 
com.googlecode.android_scripting to be resumed
D/CompatibilityInfo( 7763): appInfo = ApplicationInfo{45cc2868 
com.googlecode.android_scripting}
D/CompatibilityInfo( 7763): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7763): Application supports screen densities, 
applicationScale=1.0
I/ActivityThread( 7763): Publishing provider 
com.googlecode.android_scripting.provider.scriptprovider: 
com.googlecode.android_scripting.provider.ScriptProvider
I/global  ( 7763): Default buffer size used in BufferedReader constructor. It 
would be better to be explicit if an 8k-char buffer is required.
I/global  ( 7763): Default buffer size used in BufferedReader constructor. It 
would be better to be explicit if an 8k-char buffer is required.
I/ActivityThread( 7763): Publishing provider 
com.googlecode.android_scripting.provider.apiprovider: 
com.googlecode.android_scripting.provider.ApiProvider
I/ActivityManager( 1457): Start proc com.googlecode.perlforandroid for content 
provider com.googlecode.perlforandroid/.PerlProvider: pid=7772 uid=10052 
gids={3003, 1015}
I/dalvikvm( 7772): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
I/dalvikvm( 7772): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=62)
D/CompatibilityInfo( 7772): appInfo = ApplicationInfo{45cc27b8 
com.googlecode.perlforandroid}
D/CompatibilityInfo( 7772): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7772): Application DOESN'T support screen densities, 
applicationScale=1.125
I/ActivityThread( 7772): Publishing provider 
com.googlecode.perlforandroid.perlprovider: 
com.googlecode.perlforandroid.PerlProvider
D/dalvikvm( 7763): GC freed 5041 objects / 385312 bytes in 77ms
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.perlforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.perlforandroid/files/perl/perl
I/ActivityManager( 1457): Start proc com.googlecode.rhinoforandroid for content 
provider com.googlecode.rhinoforandroid/.RhinoProvider: pid=7779 uid=10019 
gids={3003, 1015}
I/dalvikvm( 7779): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
I/dalvikvm( 7779): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=64)
D/CompatibilityInfo( 7779): appInfo = ApplicationInfo{45cc26f8 
com.googlecode.rhinoforandroid}
D/CompatibilityInfo( 7779): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7779): Application DOESN'T support screen densities, 
applicationScale=1.125
I/ActivityThread( 7779): Publishing provider 
com.googlecode.rhinoforandroid.rhinoprovider: 
com.googlecode.rhinoforandroid.RhinoProvider
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.rhinoforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/system/bin/dalvikvm
I/ActivityManager( 1457): Start proc com.googlecode.pythonforandroid for 
content provider com.googlecode.pythonforandroid/.PythonProvider: pid=7786 
uid=10045 gids={3003, 1015}
I/global  ( 7763): Default buffer size used in BufferedReader constructor. It 
would be better to be explicit if an 8k-char buffer is required.
I/global  ( 7763): Default buffer size used in BufferedReader constructor. It 
would be better to be explicit if an 8k-char buffer is required.
I/dalvikvm( 7786): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
D/dalvikvm( 1439): GC freed 307 objects / 11704 bytes in 72ms
I/dalvikvm( 7786): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=66)
D/CompatibilityInfo( 7786): appInfo = ApplicationInfo{45cc27c0 
com.googlecode.pythonforandroid}
D/CompatibilityInfo( 7786): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7786): Application DOESN'T support screen densities, 
applicationScale=1.125
D/dalvikvm( 1439): GC freed 57 objects / 2608 bytes in 80ms
I/ActivityThread( 7786): Publishing provider 
com.googlecode.pythonforandroid.pythonprovider: 
com.googlecode.pythonforandroid.PythonProvider
D/dalvikvm( 1439): GC freed 2 objects / 48 bytes in 75ms
D/dalvikvm( 7763): GC freed 7862 objects / 446064 bytes in 147ms
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.perlforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.perlforandroid/files/perl/perl
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.pythonforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.pythonforandroid/files/python/bin/python
I/ActivityManager( 1457): Start proc com.googlecode.tclforandroid for content 
provider com.googlecode.tclforandroid/.TclProvider: pid=7794 uid=10047 
gids={3003, 1015}
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.rhinoforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/system/bin/dalvikvm
I/dalvikvm( 7794): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
I/dalvikvm( 7794): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=60)
D/CompatibilityInfo( 7794): appInfo = ApplicationInfo{45cc27b8 
com.googlecode.tclforandroid}
D/CompatibilityInfo( 7794): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7794): Application DOESN'T support screen densities, 
applicationScale=1.125
I/ActivityThread( 7794): Publishing provider 
com.googlecode.tclforandroid.tclprovider: 
com.googlecode.tclforandroid.TclProvider
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.pythonforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.pythonforandroid/files/python/bin/python
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.tclforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.tclforandroid/files/tclsh/tclsh
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.tclforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.tclforandroid/files/tclsh/tclsh
I/ActivityManager( 1457): Start proc com.googlecode.luaforandroid for content 
provider com.googlecode.luaforandroid/.LuaProvider: pid=7803 uid=10055 
gids={3003, 1015}
I/dalvikvm( 7803): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
I/dalvikvm( 7803): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=60)
D/CompatibilityInfo( 7803): appInfo = ApplicationInfo{45cc26f8 
com.googlecode.luaforandroid}
D/CompatibilityInfo( 7803): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7803): Application DOESN'T support screen densities, 
applicationScale=1.125
I/ActivityThread( 7803): Publishing provider 
com.googlecode.luaforandroid.luaprovider: 
com.googlecode.luaforandroid.LuaProvider
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.luaforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.luaforandroid/files/lua/bin/lua
I/ActivityManager( 1457): Start proc com.googlecode.bshforandroid for content 
provider com.googlecode.bshforandroid/.BshProvider: pid=7810 uid=10051 
gids={3003, 1015}
I/dalvikvm( 7810): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=38)
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.luaforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/data/data/com.googlecode.luaforandroid/files/lua/bin/lua
I/dalvikvm( 7810): Debugger thread not active, ignoring DDM send (t=0x41504e4d 
l=60)
D/CompatibilityInfo( 7810): appInfo = ApplicationInfo{45cc27b8 
com.googlecode.bshforandroid}
D/CompatibilityInfo( 7810): Archos5: force flags LARGE_SCREENS and EXPANDABLE
D/CompatibilityInfo( 7810): Application DOESN'T support screen densities, 
applicationScale=1.125
I/ActivityThread( 7810): Publishing provider 
com.googlecode.bshforandroid.bshprovider: 
com.googlecode.bshforandroid.BshProvider
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.bshforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/system/bin/dalvikvm
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Interpreter 
discovered: com.googlecode.bshforandroid
V/sl4a.InterpreterConfiguration$InterpreterListener:127( 7763): Binary: 
/system/bin/dalvikvm
D/dalvikvm( 7763): GC freed 8892 objects / 493384 bytes in 48ms
D/dalvikvm( 7763): GC freed 9310 objects / 550848 bytes in 112ms
D/dalvikvm( 7763): GC freed 9589 objects / 462368 bytes in 124ms
D/dalvikvm( 7763): GC freed 13096 objects / 553744 bytes in 66ms
I/ActivityManager( 1457): Stopping service: 
com.googlecode.android_scripting/.activity.TriggerService
W/InputManagerService( 1457): Got RemoteException sending setActive(false) 
notification to pid 7067 uid 10018
I/ActivityManager( 1457): Displayed activity 
com.googlecode.android_scripting/.activity.ScriptManager: 4545 ms (total 8752 
ms)
I/ActivityManager( 1457): Starting activity: Intent { 
cmp=com.googlecode.android_scripting/.activity.LogcatViewer }
V/sl4a.Process:115( 7763): Executing /system/bin/logcat with arguments [] and 
with environment {}
D/dalvikvm( 7763): Trying to load lib 
/data/data/com.googlecode.android_scripting/lib/libcom_googlecode_android_script
ing_Exec.so 0x45cc68b0
D/dalvikvm( 7763): Added shared lib 
/data/data/com.googlecode.android_scripting/lib/libcom_googlecode_android_script
ing_Exec.so 0x45cc68b0
D/dalvikvm( 7763): No JNI_OnLoad found in 
/data/data/com.googlecode.android_scripting/lib/libcom_googlecode_android_script
ing_Exec.so 0x45cc68b0
D/dalvikvm( 7763): +++ not scanning '/system/lib/libwebcore.so' for 
'createSubprocess' (wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libexif.so' for 
'createSubprocess' (wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libFFTEm.so' for 
'createSubprocess' (wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libmedia_jni.so' for 
'createSubprocess' (wrong CL)
I/ActivityManager( 1457): Displayed activity 
com.googlecode.android_scripting/.activity.LogcatViewer: 155 ms (total 155 ms)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libwebcore.so' for 'waitFor' 
(wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libexif.so' for 'waitFor' 
(wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libFFTEm.so' for 'waitFor' 
(wrong CL)
D/dalvikvm( 7763): +++ not scanning '/system/lib/libmedia_jni.so' for 'waitFor' 
(wrong CL)
I/global  ( 7763): Default buffer size used in BufferedReader constructor. It 
would be better to be explicit if an 8k-char buffer is required.
D/dalvikvm( 7763): GC freed 3620 objects / 277728 bytes in 57ms

Original comment by frank.we...@gmail.com on 14 Feb 2011 at 6:03