Hi; I have a little question about QList and memory usage. On my header I have a QList pointer:
QList<MyObjectData> *myList;
QList<MyObjectData> *myList;
To copy to clipboard, switch view to plain text mode
on class an init method
void MyClass::init(){
myList= new QList<MyObjectData>;
}
void MyClass::init(){
myList= new QList<MyObjectData>;
}
To copy to clipboard, switch view to plain text mode
periodically I feed my list with new elements :
void MyClass::feedList(int id){
MyObjectData mod;
mod.setId(id);
myList->append(mod);
}
void MyClass::feedList(int id){
MyObjectData mod;
mod.setId(id);
myList->append(mod);
}
To copy to clipboard, switch view to plain text mode
and method called by a timer take this data, use them and removing by calling removeAt(0) :
void MyClass::useData(){
if(commandRequest->size()>0 && busy == false)
{
busy = true;
executeSomething((MyObjectData )myList->at(0));
myList->removeAt(0);
busy = false;
}
}
void MyClass::useData(){
if(commandRequest->size()>0 && busy == false)
{
busy = true;
executeSomething((MyObjectData )myList->at(0));
myList->removeAt(0);
busy = false;
}
}
To copy to clipboard, switch view to plain text mode
can be any memory issue whit these methods? thank you...
Bookmarks