Stack Overflow on Android

Jan Burse, created Oct 21. 2013 alex, Oct 18. 2013, 20:45, wrote: Hello, I have a stack overflow on my Android device and not on the PC. Ok my program is not optimised. But , is it possible to grow the stack Size ? Thanks Antoine

Comments

Re: Stack Overflow on Android

alex, created Nov 09. 2013 Hi Jan, Thanks a lot for your job. I'll wait, and perhaps for Christmas in my little shoes :-) Have a nice evening. Alex

Re: Stack Overflow on Android

Jan Burse, created Nov 08. 2013 Hi Alex, I have uploaded your code on: http://www.xlog.ch/jekejeke/support/alex.p As the screenshot below shows the upcoming release 0.9.12 of Jekejeke Prolog can manage the lists. So the bug fix seems to work. But please be patient, it will still take some additional weeks untill the new release will be published. Approximately every 2-3 months there is a new release. Bye

Re: Stack Overflow on Android

alex, created Nov 06. 2013 Hi Bruce, Here is a portion of code. the predicate genLst(0,[1,2,3, ...., 25], X) generates an overflow on android device. Code in the next message ... remark: random fonction générate always the same séquence of number until exit prolog. Is there a function to reset this function ? Thanks a lot for your feedback Alex

Re: Stack Overflow on Android

Jan Burse, created Oct 28. 2013 Dear Alex, Thanks for reporting a stack trace and thanks for likeing Jekejeke Prolog. I have a hypothesis about the cause of the problem. It has to do with tail recursion and large data structures. Normally tail recursion is used so that long lists work fine. But in the present case, in an internal dereferencing operation, the tail recursion went not along the tail of a pair, but along the head of a pair. Causing normal recursion for the tail of a pair, and thus a stack overflow. I will try to fix the problem for the next release 0.9.12. Do you have the Prolog code by chance, so that I can do some testing? Bye P.S.: I don't show a confirm dialog on exit, since there is usually no usaved state. But your application scenario might be different.

Re: Stack Overflow on Android

alex, created Oct 25. 2013 Hello Jan, Thanks for your reponse. My device is an Android 2.3 The problem report is : java.lang.StackOverflowError at jekpro.model.d.c.a(Unknown Source) at jekpro.model.d.c.a(Unknown Source) .... at jekpro.tools.api.Interpreter. UnfoldChecked(UnKnown Source) at jekpro.util.a.g.run(Unknown Source) at java.lang.Thread.run(Thread.java:1019) It fails on a predicate that tranform a list of 450 item in a random order It's a good id to put a parameter in setup. It'is possible to have a confirm window on exit prolog ? In french : Bravo c'est vraiment un bon interpreter prolog !!! Alex

Re: Stack Overflow on Android

Jan Burse, created Oct 21. 2013 Dear alex, The Jekejeke Prolog Runtime has 3 different stacks: - Prolog Stack: This stack is allocated in the heap, and multiple Prolog threads share the same heap. It is limited by the heap. The stack is used whenever a clause is instantiated to allocate the variables. This stack typically overflows when you have a deep recursion predicate with new variables. - Engine Java Stack: This stack is usually allocated in the thread stack space. It is usually limited by the thread stack size. The stack is used per Prolog thread by elementary operations such as unify, copy term, equal etc.. The stack typically overflows when you have a cyclic term or a very large term. - GUI Java Stack: This stack is usually allocated in the thread stack space. It is usually limited by the thread stack size. The stack is used by the single GUI stack that handles the user interface. We had an error here in release 0.9.10, but it should be gone in releae 0.9.11. To further analyze your problem and to see to which stack the problem belongs, we would need further details about the error message. If the problem persists to the Engine Java Stack, I could introduce an option for that. The default Android thread stack size is API 3 (Android 1.5) = 8KB API 4-10 (Android 1.6 - Android 2.3.7) = 12KB API 14-17 (Android 4.0 - Android 4.2.2) = 16KB , and it can be increased up to 256KB. On the PC the workaround would be to use the -Xss option on the command line. But a command line is usually not available on Android. So putting this in the settings dialog would make sense. Bye