Qt QContiguousCache每次调用时都在泄漏内存
Im使用QContiguousCache保存项目数据。我观察到的是,当我开始调用QContiguousCache setCapacity时,它正在泄漏内存。出于测试目的,我开始在timerEvent中调用QContiguousCache类,并且每次调用时内存都在释放Qt QContiguousCache每次调用时都在泄漏内存,qt,Qt,Im使用QContiguousCache保存项目数据。我观察到的是,当我开始调用QContiguousCache setCapacity时,它正在泄漏内存。出于测试目的,我开始在timerEvent中调用QContiguousCache类,并且每次调用时内存都在释放 void MyListModel::timerEvent(QTimerEvent *event) { if (event->timerId() == timer.timerId()) { qDebug(
void MyListModel::timerEvent(QTimerEvent *event)
{
if (event->timerId() == timer.timerId()) {
qDebug()<<"Continusous cache";
QContiguousCache<int> cache; // = new QContiguousCache<datatmp>();
cache.setCapacity(10000);
qDebug()<<"Cache count:"<<cache.count();
while(cache.count())
{
cache.removeLast();
}
cache.detach();
}
}
void MyListModel::timerEvent(QTimerEvent*事件)
{
如果(事件->timerId()==timer.timerId()){
qDebug()Hm,QContiguousCache
具有detach()
函数?它是哪个Qt版本?Qt 5.9.0版本。