good morning everyone, I think i found a memory leak while using ListView and ListModel.
code is quite simple, just a ListView and a delegate which’s duty is to show the image from the model’s data(src).
the running of qml is ok, but when we flick the listview as many as times, i found the using memory is increased without a limit. it’s possiable increase to 1GB if we try as many as times.
attachmemt is the code.
the code is show as follow :
import QtQuick 2.0
Rectangle {
id : viewer
width: 800
height: 480
function addItem()
{
picSrcList.append({"src":"file:///e:/pic/more/02z.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/01.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/02.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/02s.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/3.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/4.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/5.jpg"});
picSrcList.append({"src":"file:///e:/pic/more/6.jpg"});
}
ListModel {
id : picSrcList
}
Component {
id : picDelegate
Image {
source: src
fillMode: Image.PreserveAspectFit
asynchronous: true
width: viewer.width
height: viewer.height
}
}
ListView {
id :picListView
anchors.fill: parent
delegate: picDelegate
model : picSrcList
orientation : ListView.Horizontal
snapMode: ListView.SnapOneItem
}
Component.onCompleted: {
addItem()
}
}
is my code has any problem?
I report this “BUG?” to https://bugreports.qt-project.org/browse/QTBUG-31007
does anybody could help me to test this code and find out if it has a memory leak.
thanks so much.
↧