Hi,
i am building a single page application with vue.js and verge using your lately released vue template.
Thanks a lot for the template, it made the setup process quite fast.
When loading different verge scenes using vue router and the template components a memory leak occurs as the app and scene data is not cleaned up automatically. This causes the app to stop working
I managed to fix this problem by returning the created verge App instance from the createApp() method and then using the app dispose() method to clean up the app.
dispose verge api link
All works well now and i can load as many scenes as i want. Here is the implementation of the script in the vue template
<script>
import * as V3DApp from '../verge3d/app.js'
export default {
name: 'V3DApp',
props: {
app: {
type: String,
required: true
}
},
data: function() {
return {
containerId: V3DApp.CONTAINER_ID,
vergeApp: null
}
},
mounted: function() {
this.vergeApp = V3DApp.createApp()
},
beforeDestroy() {
// this.vergeApp.unload()
this.vergeApp.dispose()
}
}
</script>
The memory footprint of the app sometimes still behaves a bit strange it seems rather big after loading multiple scenes. But that could be just a strange browser behaviour.
Thats why i wanted to ask if there is additional things that should be removed from memory??
-The cleaned up vergeApp instance stays in memory. Should be deleted as well? Not sure if it is auto garbage collected?
– is it enough to call dispose() or do i need to call first unload() and then dispose(). It’s not 100% clear what the difference between dispose and unload is reading the api docs
– is there anything else that should be removed from memory (can’t think of something else but maybe i am missing something)
Thanks for all of your great work on Verge
Kind Regards
Sebastian