It is currently Fri May 26, 2017 7:27 pm



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  [ 24 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: "low memory" solution please
Unread postPosted: Fri Dec 18, 2015 1:30 pm 
Offline
User avatar

Joined: Tue Nov 04, 2014 7:12 am
Posts: 124
Hello!
Thank you!
i found: "20804 2015/04/29 gikam Interrupt OnLowMemory:"
how to see this topic?

_________________
"Unfortunately I only BASIC to understand. Everything else I need strong help..." :P


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Fri Dec 18, 2015 5:18 pm 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5518
Location: Paris, France
post20804.html#p20804

_________________
- Creator of the Android BASIC! Compiler


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Sat Dec 19, 2015 4:00 am 
Offline
User avatar

Joined: Tue Nov 04, 2014 7:12 am
Posts: 124
How to solution these from basic?
Please a basic codes :) .

_________________
"Unfortunately I only BASIC to understand. Everything else I need strong help..." :P


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Sat Dec 19, 2015 4:48 am 
Offline
User avatar

Joined: Sat Dec 08, 2012 2:14 am
Posts: 1135
Location: From Blighty
I don't think you can code a solution. I think at the moment it just flags a message to the console.

I am not sure why it's not passed to the error messaging run time stuff.

There must be a reason, without a simple solution - hence being on "The List".

Maybe a CONSOLE.READ would be a good idea for a command so anything popping up there we could maybe attempt a work around for any bizarre developing errors...

Mog


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Tue Dec 22, 2015 1:24 pm 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2797
Location: Colorado, U.S.
I'm sorry, perhaps I am reading too fast, but I do not understand what you want me to fix. You say you want a '"low memory" solution', but what is the problem?
1: Your system is running low on memory and soon Android is going to kill your app.
2: You are running a program that uses the console and you keep getting these annoying "Warning: Low Memory" messages. You don't want those messages.

If your problem is 1., there is nothing I can do about it. I can not control what your Android device is running.

If you problem is 2., there is already a solution.
QBFan wrote:
Hello!just one question:
This "Warning: low memory" is added to the geterror$() variable? :roll:
No. It is written directly to the console, unless you have an "OnLowMemory:" label in your program.

Oops! I looked for OnLowMemory: in the manual, but it is not there. I am sorry. I made the change to BASIC! on May 17, 2015, so it was in v01.88. It was part of a huge change in interrupt-handling, and I forgot to write it in the manual. I will fix that for the v01.89 manual.

Here is how you use it:
Code:
<your program>
ONLOWMEMORY:
<do what you want>
LOWMEMORY.RESUME

If you don't have the OnLowMemory: interrupt label, you will get "Warning: Low Memory" on the Console.
If you do have the OnLowMemory: label, then when Android issues a Low Memory warning, your program will run the code between OnLowMemory: and LowMemory.Resume, just like any other interrupt. You can post a warning, delete some bitmaps, whatever you want. Or you can just do nothing. You won't see anything on the Console.

- Marc


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Tue Dec 22, 2015 3:40 pm 
Offline
User avatar

Joined: Tue Nov 04, 2014 7:12 am
Posts: 124
Hello!
Thank you!
These is useful!
Onlowmemory: if there is, the more like it, I did not know this.
(For the complete problem please
see first and #6 post.)

_________________
"Unfortunately I only BASIC to understand. Everything else I need strong help..." :P


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Wed Dec 23, 2015 11:52 am 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2797
Location: Colorado, U.S.
Mog: Sorry, I missed your comment about CONSOLE.READ. That already exists, it is called CONSOLE.LINE.TEXT.

QBFan: Perhaps, when you get a Low Memory warning, you could clear the display list and rebuild your screen. That might clear out some memory. Also you could delete any old bitmaps. In your program you should be careful that old bitmaps are deleted when you do not need them any more. With OnLowMemory: you could search for old bitmaps that did not get deleted.

If your app is using the screen, it will not get killed. A Low Memory warning when you are using the screen may mean some other app will be killed.

If your app is in the background, a Low Memory warning means your app may be killed. In that case, you may want to save everything you can in a file and exit the program. When you start the program again, it finds the save file and rebuilds the game so you can start where you left off.

- Marc


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Sun Dec 27, 2015 5:37 am 
Offline
User avatar

Joined: Tue Nov 04, 2014 7:12 am
Posts: 124
Hello!

I put to the apk also this (temporarily):
!------------------------------------------------
onlowmemory:
olm=1
gosub writedata
popup"low memory!"
lowmemory.resume
!------------------------------------------------
If someone sees (popup message)
Then thank you when write - please write it to me (if you like) with "game counter 1" value.
Thank you. - I'm trying to find out what cause
As you can see, there is no unnecessary bitmap that I delete.
see these also (for game link):
http://rfobasic.freeforums.org/post26043.html#p26043
http://rfobasic.freeforums.org/post25710.html#p25710

_________________
"Unfortunately I only BASIC to understand. Everything else I need strong help..." :P


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Tue Dec 29, 2015 1:50 pm 
Offline

Joined: Wed Feb 15, 2012 11:24 pm
Posts: 256
Location: TN
Code:
threshhold = 5
fn.def Free(threshhold)
system.open
system.write "free -b | awk 'FNR == 3 {print $4/($3+$4)*100}'"
pause 100
do
  System.read.ready rdy
until rdy

system.read.line o$
print "Free Memory" + o$
if VAL(o$) > threshhold then
  system.write "ps | grep -v basic | sort -nk2 | head -n100 | awk '{print $2}' | xargs kill -9"
  print "top 100 ram eating. processes destroyed"
endif

system.close
fn.rtn 1
fn.end

REM kill top 100 processes when free ram is below 5mb
call Free(5)


Couldn't find the thread I posted this in. One user suggests this would only kill foreground apps. Fixes welcome. But I'm jumping ship on this one. LG flex


Report this post
Top
 Profile  
 
 Post subject: Re: "low memory" solution please
Unread postPosted: Fri Dec 09, 2016 3:14 pm 
Offline

Joined: Mon Nov 14, 2016 6:49 am
Posts: 39
I have found out very strange programmers effect.
I have removed crucial lines from run.java source code to avoid "Warning: low memory" message. But when I have compiled Basic program from The .apk which I have build from this little source code modification, when running compiled .apk in compiler rfo-basic mode, Warning low memory message have been back again. It is very strange. I have used latest Quick apk for Basic. I have put compiled basic.apk with little run.java change. It is very strange, that if I run program by using Rfo-basic notepad flavour on my Android, I can play eve my live stream for one hour without this error message. But after compilation, low memory warning is still back again. Sure, bug is being displayed after longer time than before. So I Am wondering, if Android core also contain this message? Or quick apk is combining my .apk with some parts from Internet stable variant of Rfo-basic? To avoid chaos, here my is direct link for The .apk file with no low memory warning.
https://www.dropbox.com/s/5jhad68b69x5l ... c.apk?dl=1
For now, I was able to play my favourite live radio station for one hour with no Android crash. Even MTP Android process have not been automatically killed. Only my alternate screen launcher for visually impaired have been terminated, but no problem. Because Android is able to reload it when pressing Back button when Basic window is on The foreground. The more difficult scenario is, if timer is being programmed and tone command have been used for every one second. Low memory warning is causing Basic program to terminate. So I will test it, what will happen.


Report this post
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 0 guests


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