Hi Martin,
I just tried a small example to download a queue using a single DownloadableResource component das is dynamically created and destroyed. Observing the memory consuption, everything looks fine. Maybe that could be something you can try as well. Potentially the issue also does not come from downloading, but somewhere else in your application, maybe how you use the downloaded files?
Here is the example:
import Felgo 3.0
import QtQuick 2.0
App {
id: app
// You get free licenseKeys from https://felgo.com/licenseKey
// With a licenseKey you can:
// * Publish your games & apps for the app stores
// * Remove the Felgo Splash Screen or set a custom one (available with the Pro Licenses)
// * Add plugins to monetize, analyze & improve your apps (available with the Pro Licenses)
//licenseKey: "<generate one from https://felgo.com/licenseKey>"
Component.onCompleted: {
console.debug("DownloadableResource.UnAvailable " + DownloadableResource.UnAvailable)
console.debug("DownloadableResource.Available " + DownloadableResource.Available)
console.debug("DownloadableResource.Downloading " + DownloadableResource.Downloading)
console.debug("DownloadableResource.Extracting " + DownloadableResource.Extracting)
}
property var baseUrl: "https://felgo.com/resources/"
property var queue: [
"resources_balloonpopfelgo.zip",
"resources_crazycarouselfelgo.zip",
"resources_doodlejump_felgo.zip",
"resources_flappybirdfelgo.zip",
"resources_flaskofrum_felgo.zip",
"resources_juicysquash_felgo.zip",
"resources_multiscenemultilevelfelgo.zip",
"resources_rubesidescroller_felgo.zip",
"resources_stacktheboxfelgo.zip"
]
property int queueIndex: 0
property var downloaderReference: undefined
NavigationStack {
Page {
title: qsTr("Main Page")
AppButton {
anchors.centerIn: parent
text: "Download"
onClicked: {
downloadAll()
}
}
}
}
function downloadAll() {
downloadNext()
}
function downloadNext() {
console.debug("downloadNext " + queueIndex)
if(downloaderReference) {
console.debug("destroying reference")
downloaderReference.destroy()
downloaderReference = undefined
}
if(queueIndex >= queue.length) {
console.debug("All done")
return
}
var downloader = downloaderComponent.createObject(app,{source: baseUrl + queue[queueIndex]})
downloaderReference = downloader
//downloader.source = baseUrl + queue[queueIndex]
console.debug("Calling download " + downloader.source)
downloader.download()
queueIndex++
}
Component {
id: downloaderComponent
DownloadableResource {
storageLocation: FileUtils.AppDataLocation
extractAsPackage: false
onStatusChanged: {
console.debug("DownloadableResource status " + status)
}
onDownloadFinished: {
downloadNext()
}
}
}
}
Best,
Alex