|
Post by kokenge on Nov 27, 2009 8:46:08 GMT -5
How do you keep rbp memory usage down? The only way I know is to stop Run Basic and restart it. Don't like that option!
I'm using XP with 2GIG memory. I monitored the usage. When RBP starts it's at 30,662K. About 45 minutes later it's at 384,972K. After about an hour and 10 minutes it's at 487,428K
Received a "Memory low" message after about an hour and 20 minutes and rbp memory usage is at 543,087K I had to stopped rbp and restart it.
CPU time for the RBP project starts at about 18% to 20% and slowly increases to about 49% to 51%.
So how did everyone else solve this? Thanks for the help.. Dan
|
|
|
Post by votan on Nov 27, 2009 9:51:48 GMT -5
Hmmmm... never actually looked at this as I never run into this problem due to regularly rebooting... but it seems like RB just caches everything.... but when a session expires, it does not release the cached portions from memory again. Could also be an artifact of compiling a project every time it is called again and again!? Guess the only one who can really tell what is going on is carl.....
|
|
|
Post by Psycho on Nov 27, 2009 10:17:28 GMT -5
I can't say I've seen the same problem you've encountered. My desktop at work hosts RB and has been running 24/7 since April 2008. About the only time I re-boot is when Windows forces a restart due to updates. It's on a 2.4ghz P4 with 1GB of RAM running there. I host about 8 programs on it and one in particular is used extensively throughout the day. I have a memory program on it (where you can monitor usage via a small icon near the clock) and have never gotten into any memory critical conditions. About 2 months ago I had CPU usage spike to 100% and bog everything but I'm suspicious that it is something in an obscure area of my program having a bug. It happened twice within about a week and never again since Unless there's something within your code itself causing this, I'd guess votan's comment about Carl would be accurate. John "Psycho" Siejkowski
|
|
|
Post by kokenge on Nov 27, 2009 12:20:13 GMT -5
This particular project monitors Airplane instruments via a Analog to Digital converter, and gets avionics from a GPS. There are other buttons that displays maps to follow the GPS. Since the instrument panel is on a server, you can actually watch the pilot fly from anywhere in the world. A setup allows the user to design and layout their own panel. Attached is a couple panels. It pulses the instruments every 3 seconds when the [Pulse] button is pressed. The program fires a backend program that interfaces to the instrments and sends the data to the instrument panel display. It keeps a log that is useful for analyzing stuff like fuel flow against engine RPM and altitude, or anything you want to cross check. So basically it has to compile the backend program every three seconds. I have other systems that monitor manufacturing processes and opens and closes gates on the manufacturing floor based on formula supplied in a production control file. So it don't do much, it just keeps doing it over and over.. Because of the need for interfaces to people on the web I cannot go back to stand alone languages such as LB. I may have to convert this to PHP. Thanks for the help.. Attachments:
|
|
|
Post by Carl Gundel - admin on Nov 27, 2009 13:53:58 GMT -5
Dan,
I have not seen this. I wonder if it is somehow due to the sort of database programming you do. Maybe there is a memory leak in the SQLite accessor. I'll try to figure that out.
-Carl
|
|
|
Post by kokenge on Nov 27, 2009 13:59:14 GMT -5
I'll change the backend process and burn in some instrument code and completely eliminate SQLite.
I'll get back... Stay tuned.. Dan
|
|
|
Post by kokenge on Nov 27, 2009 14:41:55 GMT -5
Ok.. Reduced the backend program to 3 lines of code. The memory usage continues to grow.. A lot slower. I guess that's because the program is only 3 lines now. It gets the seconds, and sends it back. It backend is working because I see it display the seconds on the front end screen. Here is the backend code. ss = time$("seconds") sendBack$ = "errMsg|";ss;"|" raw sendBack$
The JS code I have uses a 2 part message separated with a vertical bar (|). 1. The ID where you want to display 2. The data to display.. In this case the seconds You can have as many of these message pairs as you like. HTH.. Dan
|
|
|
Post by StefanPendl on Nov 27, 2009 19:39:49 GMT -5
Received a "Memory low" message after about an hour and 20 minutes and rbp memory usage is at 543,087K I had to stopped rbp and restart it. Dan, RB allows to use a maximum of 1GB of memory, so I don't think you should get a warning, if there is just half of the maximum memory used. BTW, if you do not tune XP, the system will reserve 2GB of memory. You can reduce this to 1GB by using the /3GB boot.ini switch. For certain configurations it is recommended to use the /USERVA=2900 switch in addition. The /3GB switch is only supported by XP Professional.You may use Process Explorer from the Sysinternals Suite to monitor the system.
|
|
|
Post by Carl Gundel - admin on Nov 27, 2009 20:04:45 GMT -5
Okay, so my next question is, how are you executing this background program? -Carl Ok.. Reduced the backend program to 3 lines of code. The memory usage continues to grow.. A lot slower. I guess that's because the program is only 3 lines now. It gets the seconds, and sends it back. It backend is working because I see it display the seconds on the front end screen. Here is the backend code. ss = time$("seconds") sendBack$ = "errMsg|";ss;"|" raw sendBack$
The JS code I have uses a 2 part message separated with a vertical bar (|). 1. The ID where you want to display 2. The data to display.. In this case the seconds You can have as many of these message pairs as you like. HTH.. Dan
|
|
|
Post by kokenge on Nov 28, 2009 4:48:26 GMT -5
Here is a test and the routine I use. It sends a message every second.
Requires two RB projects: test : the front end program testbe : the back end.
Remember to publish testbe.
The front end test.bas
' ==================================================================== ' JavaScript timer routine ' once a second .. or steTimeout at 1000 ' -------------------------------------------------------------------- html "<script type='text/javascript'> var c=0; var t; var x;
function timedPulse() { if (c != 0) { x = server('/seaside/go/runbasicpersonal?app=testbe&funct=runTest'); t = setTimeout('timedPulse()',1000); } }
// start the timer function startTimer() { c = 1; x = timedPulse(); } // Stop Timer function stopTimer() { c = 0; } </script> "
' ------------------------------------------------- ' Backend communications ' ------------------------------------------------- html "<script language='javascript'> <!-- function createRequestObject() { var ro; var browser = navigator.appName; if(browser == 'Microsoft Internet Explorer') { ro = new ActiveXObject('Microsoft.XMLHTTP'); } else { ro = new XMLHttpRequest(); } return ro; }
var http = createRequestObject();
function trim(string) { while (string.substring(0,1) == ' ') { string = string.substring(1, string.length); } while (string.substring(string.length-1, string.length) == ' ') { string = string.substring(0,string.length-1); } return string; }
function handleResponse() { if(http.readyState == 4) { var response = http.responseText; //alert ('got back from server response:' + response); var at = 0; // --- strip leading junk ---- x = response.substring(0,1); while (x < '0') { response = response.substring(1); x = response.substring(0,1); } var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); x = update.length; // alert ('update length:' + x); for (i=0;i<x;i++) { update[i] = update[i].replace(/;;/g ,'|'); } for (i=1;i<x;i=i+2) { at = i - 1; update[at] = trim(update[at]); // alert ('at:' + at + '|update[at]:' + update[at] + '|i:' + i + '|update[i]:' + update[i]); try { ss = document.getElementById(update[at]); ssv = ss.value; sse = ss.element; sst = ss.title; ssn = ss.name; ssi = ss.id; ssh = ss.innerHTML; // alert ('ss:' + ss + '|ssv:' + ssv + '|sse:' + sse + '|ssn:' + ssn + '|ssi:' + ssi + '|ssh:' + ssh + '|at:' + update[at] + '|i:' + update[i] ); if (ssv != undefined) ss.value = update[i]; else if (ssh != undefined) ss.innerHTML = update[i]; } catch(err) { alert ('Invalid display field:' + update[at]); } } } } }
function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""""); } function ltrim(stringToTrim) { return stringToTrim.replace(/^\s+/,""""); } function rtrim(stringToTrim) { return stringToTrim.replace(/\s+$/,""""); } function server(prog) { prog = ltrim(prog); // Left trim rs = http.readyState; // see if the previous task it done - state must be 0 if (rs == 4) rs = 0; if (rs != 0) { rs = 0; // ?????? why don't this work ??????/ try { rs = http.readyState; // see if the previous task is done - state must be 0 } catch(err) { rs = 1; alert ('Server Busy. Please try again. Thank you and have a nice day ' + rs); } } if (rs == 0) { prog1 = ''; xx = ''; if(prog.indexOf('|' != -1)) { val = prog.split('|'); for ( key in val) { // alert('key:' + key + ' |val:' + val[key]); x = ''; xx = val[key]; if (key & 1) { try { x = document.getElementById(xx).value; toe = document.getElementById(xx).type; // type of element chk = document.getElementById(xx).checked; prog1 = prog1 + x; } catch(err) { // alert ('--error----xx:' + xx + '|err:' + err.description); prog1 = prog1 + err.description; } // alert ('------x:' + x + '| toe:' + toe + '| chk:' + chk); } else prog1 = prog1 + xx; } } var d=new Date(); var t=d.getTime(); // alert ('server side get program| prog1:' + prog1); prog1 = prog1 + '&ms' + t //alert ('prog1 ' + prog1 + ' xx:=>' + xx + ' t:=>' + t) http.open('get', prog1); http.onreadystatechange = handleResponse; http.send(null); } } //--></script> "
'==================================================================================== ' Main line code ' ===================================================================================
html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 bgcolor=wheat width=30%>" html "<TR align=center><TD>" html "<INPUT TYPE='button' value='Start' onClick=""startTimer();"">" html "</TD><TD>" html "<INPUT TYPE='button' value='Stop' onClick=""stopTimer();"">" html "</TD></TR></TABLE>"
html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR><TD BGCOLOR=#FF9966 id=msg1></TD></TR> <TR><TD BGCOLOR=#FFFF66 id=msg2></TD></TR> <TR><TD BGCOLOR=#99FFCC id=msg3></TD></TR> </TABLE>"
wait
The back end program: testbe.bas
funct$ = word$(UrlKeys$,2,"&") ms$ = word$(UrlKeys$,2,"&ms") ms = val(ms$) sendBack$ = "msg1|Send Time:";ms$;" UrlKeys:";UrlKeys$;"|msg2|";funct$;"|"
ss = time$("seconds") ti$ = time$() bar$ = "<div style='width:";ss mod 300;"px; background:blue;'> </div>" sendBack$ = sendBack$ + "msg3|Send Time:";ss;" ";ti$;" ";bar$;"|" raw sendBack$
|
|
|
Post by trenatos on Sept 9, 2011 13:41:33 GMT -5
I know this is an old thread, but did anyone solve the memory issue?
|
|
|
Post by kokenge on Sept 9, 2011 14:23:05 GMT -5
Not that I know of.. You can simply copy the code above and run it. It still eats memory..
I had to convert the system to another language to solve the problem.
I have to re-start other RunBasic systems periodically to keep them from crashing..
|
|
|
Post by trenatos on Sept 9, 2011 15:47:20 GMT -5
Wow, ok. Unfortunately if there are unhandled memory leaks I can't purchase it for developing customer applications. :/
I can't tell my customers to keep checking the memory usage or just randomly reboot RB with cron/schedulers..
|
|
|
Post by Carl Gundel - admin on Sept 10, 2011 16:34:06 GMT -5
Wow, ok. Unfortunately if there are unhandled memory leaks I can't purchase it for developing customer applications. :/ I can't tell my customers to keep checking the memory usage or just randomly reboot RB with cron/schedulers.. I'll have another look at this problem. -Carl
|
|
|
Post by trenatos on Sept 10, 2011 21:23:25 GMT -5
Thank you, I do appreciate it. Even if there is no easy fix, it would be good for us to know what causes it, we may be able to avoid certain function, settings, or create some simple work around.
|
|