Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt QContiguousCache每次调用时都在泄漏内存_Qt - Fatal编程技术网

Qt QContiguousCache每次调用时都在泄漏内存

Qt QContiguousCache每次调用时都在泄漏内存,qt,Qt,Im使用QContiguousCache保存项目数据。我观察到的是,当我开始调用QContiguousCache setCapacity时,它正在泄漏内存。出于测试目的,我开始在timerEvent中调用QContiguousCache类,并且每次调用时内存都在释放 void MyListModel::timerEvent(QTimerEvent *event) { if (event->timerId() == timer.timerId()) { qDebug(

Im使用QContiguousCache保存项目数据。我观察到的是,当我开始调用QContiguousCache setCapacity时,它正在泄漏内存。出于测试目的,我开始在timerEvent中调用QContiguousCache类,并且每次调用时内存都在释放

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版本。