QSA-interest Archive, October 2006
qsa memory increasing continueously
Message 1 in thread
I have write a small program based on the exampel scriptbutton to test
the qsa. in the script button's processing rountine, i continued call
the intercepter some times, thus 1000 times, 2000, 4000, 8000, I seen
the memory use is continuously increaseing,when the times up to 15,000.
the program crashed. In the script i let it do a multiply test just like
Script list below,Also the button action code list after it . Why the
memory usage is increasing continueously ? Is there any bugs in my program ?
Script:
var x = parseInt(Application.edit.text);
if ( isNaN( x ) )
{debug( "x is not a number" );}
else
{
var y = multiplyTest( x )
Application.lcd.value = y;
Application.labelResult.text = y.toString() ;
}
function multiplyTest(n) {
var sum = 1;
for ( i = 1; i <= n; i++ ) {
sum *= i;
}
return sum;
}
void ScriptButton::executeScript()
{
QTime timerMeasure ;
QString strTime;
int intCallTimes = 2000;
bool ok;
intCallTimes = Singleton::Instance
()->getHolder()->text().toInt(&ok, 10);
intCallTimes = qRound( intCallTimes );
if (( !ok )||(intCallTimes <= 0)){
QMessageBox::information( 0, "Input Error ",
"Key in numbers again!",
QMessageBox::Ok );
return;
}
if ( !code.isEmpty() ){
timerMeasure.restart();
for( int i = 0; i<intCallTimes; i++ ){
project->interpreter()->evaluate( code );
project->interpreter()->clear();
//Clear ?
}
}
strTime = "Time span is : " +
QString::number(timerMeasure.elapsed()) + "ms";
QMessageBox::information( 0, "Span",
strTime,
QMessageBox::Ok );
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx
Message 2 in thread
postbeerliu wrote:
> I have write a small program based on the exampel scriptbutton to test
> the qsa. in the script button's processing rountine, i continued call
> the intercepter some times, thus 1000 times, 2000, 4000, 8000, I seen
> the memory use is continuously increaseing,when the times up to 15,000.
> the program crashed. In the script i let it do a multiply test just like
> Script list below,Also the button action code list after it . Why the
> memory usage is increasing continueously ? Is there any bugs in my program ?
Hi,
I don't see anything imediatly wrong in this example and since you call
clear() after the evaluation I there all memory should be cleaned up
afterwards... Could you please send a complete compilable example to
bugs@xxxxxxxxxxxxx so that we can investigate further.
best regards,
Gunnar
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx