It is currently Fri Jun 23, 2017 6:57 am



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 12:47 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Hi,

If Android runs low on memory when BASIC! is in background and it decides to kill BASIC!, it seems that BASIC! doesn't terminate gracefully.

In fact when BASIC! is then manually restarted, Android gives "Unfortunately, BASIC! has stopped", and BASIC! must be manually restarted again.

Luca


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 1:03 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
Hi Luca,

Have you tried trapping the event with ONLOWMEMORY?

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 1:48 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
I didn't try, but I'm sure that by trapping the event this can be avoided.
Anyway yes, I agreee that this is a debatable point: do you think that it should be always up to be BASIC! programmer to do something like:
Code:
ONLOWMEMORY:
IF BACKGROUND() THEN EXIT
LOWMEMORY.RESUME

and that BASIC! should make no attempt to die gracefully when Android kills it?
Other applications typically die gracefully (of course if BASIC! were to implement this behaviour, it should do nothing on the onLowMemory event, but act much further on in the termination process, i.e. onStop or onDestroy).

Another thought: If one uses GW, then I guess the OnLowMemory event cannot be trapped if the program is stuck at GW_WAIT_ACTION$() ?
Maybe this would be a reason to prefer GW_ACTION$() instead?

Luca


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 2:16 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
I think it should be up to the BASIC! programmer to save his app settings at crucial moments like when user puts app in background, when app has too low memory...

About the ungraceful dying I'll leavr it up to jMarc to answer, I'm not fluent enough on this part of the code.

Finally to answer your question, ONLOWMEMORTY interrupt will be triggered even inside GW_WAIT_ACTION$().

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 2:18 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
If you have a look at the code of GW_WAIT_ACTION$() it's basically a DO: PAUSE 1: UNTIL GW_ACTION$()<>""

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 2:40 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Yes, the code never lies ;)
One should always remember to have a look at the code before asking questions :D

/ L

PS: Nicolas, maybe the snippet above could be useful for your Compiler too, in order to avoid crashes when left too long in background?


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 3:28 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
What crashes? :)

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 3:34 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
compiler-in-backgr-long-enough-crashes-when-resumed-minor-t4703.html

Yes, I know it doesn't reproduce on your phone...

/ L


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 4:09 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
Does it on yours?

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: Ungraceful BASIC! termination
Unread postPosted: Tue Dec 06, 2016 4:22 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Sometimes.
Maybe because I have only 1.5 GB of RAM so Android will kill apps more frequently.

/ L


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred