[gambit-list] Gambit for Android Platform

Keith Flower keith at keithflower.org
Tue Jun 28 13:09:53 EDT 2011


This (GC problems) is something I definitely encountered early on and had to take care with, and there may yet be GC-related problems. However, I can't currently generate Steve's problem with my testing (or just random use), and Android debugging output during tests indicates very regular GC (and I can drive GC harder by random allocations in my tests). Also, Android 2.2+ devices send crash reports that one supposedly can see on the Market developer console, and there have been no other reports yet. I'm looking into it, however. 

Additional details that may be helpful: when you see this problem, are you (Steve) using the REPL window exclusively or are you telneting into the REPL or using other scripts from the webview during a session? Does it occur after pasting/reusing previously executed code in the REPL window? Does it occur after leaving and reentering the app to do other tasks? In an abort, are you ever presented with the "Sorry, the application XX has stopped unexpectedly" dialog, or do you just drop immediately out of the app? Do you have the SDK? -- hooking up your phone to your computer via USB and running 

	adb logcat

in a terminal might provide a stack trace and other information on a segfault or any other problem. I can also send a version that will dump a stack trace to local storage.

Regards,

Keith

On Jun 28, 2011, at 8:40 AM, Marc Feeley wrote:

> I suspect that it might be related to garbage collection.  If the foreign code (in C) in "Gambit for Android" keeps a reference to a movable Scheme object (or to a still object whose reference count is 0), then if a GC is started from the C code, or from Scheme code called from C, then you will get a dangling reference problem.  These GC related problems tend to occur at unpredictable times.
> 
> Here's a suggestion... add a trace at the top of ___garbage_collect (in lib/mem.c) and see if the app aborts soon after a garbage collection.
> 
> Marc
> 
> On 2011-06-28, at 11:02 AM, Steve Graham wrote:
> 
>> Not sure what else or how else to test.
>> 
>> On Tue Jun 28th, 2011 5:25 AM EDT Keith Flower wrote:
>> 
>>> I have some automated JUnit/Robotium tests to drive the app. Repeated (1000x) evaluation of your example expression permuted with other test expressions and programs don't cause problems on a 1.6 emulator (the closest thing I have to your device). However, such tests won't fully exercise my fairly simpleminded Android REPL window code, so bug(s) may lie there. Any further details you note may be helpful.
>>> 
>>> Many thanks for the feedback.
>>> 
>>> On Jun 27, 2011, at 5:51 PM, Steve Graham wrote:
>>> 
>>>> Thanks, Keith.
>>>> 
>>>> Thought I should mention that sometimes even simple code causes the app to abort to the desktop.  I noticed this happening with "(* (+ 35 31.5) 45)".  Sometimes this works and sometimes it aborts.  Not sure why.
>>>> 
>>>> Steve
>>>> 
>>>> On Tue Jun 21st, 2011 1:12 PM EDT Keith Flower wrote:
>>>> 
>>>>> Hi Steve,
>>>>> 
>>>>> Thanks again for trying out the little app and providing feedback.
>>>>> 
>>>>> Depending on the kind of app you want to write, it might not currently be the most efficient process to try to use Gambit, but there are a couple of approaches one might take. If you look in the source for the app, you'll see Scheme code working with HTML for the app's "Edit Scripts" page. Another alternative would be adding Java-Native (JNI) functions to allow Gambit to make the actual Java/Android function calls you desire. You could also use Gambit to generate C code that you compile with Android's Native Development Toolkit and call from Java using JNI.
>>>>> 
>>>>> The tree recursive fibonacci example is designed to consume lots of memory (~7-8 megs), so your phone (and mine) with limited memory resources has to thrash around to satisfy those memory needs.
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Keith
>>>>> 
>>>>> 
>>>>> On Jun 21, 2011, at 7:52 AM, Steve Graham wrote:
>>>>> 
>>>>>> Keith,
>>>>>> 
>>>>>> I like your implementation, including the features beyond plain Gambit.  I wonder if someone could use it as a basis of a system for coding Android apps.
>>>>>> 
>>>>>> Question:  On the fib function, why do you suppose it was so resource hungry and experienced the faults?  I am using a G-1 running version 1.6 .
>>>>>> 
>>>>>> Thanks, Steve
>>>>>> 
>>>>>> ---
>>>>>> 
>>>>>> Gambit v4.6.1
>>>>>> 
>>>>>>> (time (fib 25))
>>>>>> 47258 ms real time
>>>>>> 8010 ms cpu time (7950 user, 60 system)
>>>>>> 47 collections accounting for  566 ms real time (550 user, 10 system)
>>>>>> 8377804 bytes allocated
>>>>>> 124 minor faults
>>>>>> no major faults
>>>>>> 75025
>>>>>> 
>>>>>> 
>>>>>> On Sat Jun 18th, 2011 7:04 PM EDT Keith Flower wrote:
>>>>>> 
>>>>>>> Inspired by Marc's iOS Gambit REPL, an alpha Android release and source are available at:
>>>>>>> 
>>>>>>> http://apps.keithflower.org/?page_id=152
>>>>>>> 
>>>>>>> Requires Android 2.2. Comments, criticism, suggestions are welcome.
>>>>>>> 
>>>>>>> Thanks to all for a great Scheme environment.
>>>>>>> 
>>>>>>> Keith
>>>>>>> _______________________________________________
>>>>>>> Gambit-list mailing list
>>>>>>> Gambit-list at iro.umontreal.ca
>>>>>>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
> 




More information about the Gambit-list mailing list