[SOLVED] Memory operations in QList..
In the QList<T>, if “append” or “insert” is called, internally “new” is performed to make room for new element.
My question is that will “delete” be performed when i call any of the “remove” function.??
or the memory will be deleted only upon call to destructor…
I am designing a code in which I need to store data of type structure.
Writing to and reading from QList will be frequent. So in order to prevent frequent “new” and “delete”, I need to know the operations behind the scene. in both cases, storing data to and removing data from QList or say in which scenarios new and delete will be performed.
Note that the internal array only ever gets bigger over the life of the list. It never shrinks. The internal array is deallocated by the destructor and by the assignment operator, when one list is assigned to another.
I found this in help page of QList. As per this, memory is de-allocated only when the destructor is called or QList is assigned to it.
I consider this as solved.