Reuse a QGraphicsScene causes memory leak



  • Hi,

    We have a QDialog added to a QGraphicsView. This QDialog contains another QGraphicsView which loads and switches two QGraphicsScene very quickly. If we allocate these two scenes only once and reuse them, the memory usage is increasing very quickly. If we properly delete them and re-create the scene, the memory usage is stable. No obvious leak can be observed.

    Attached is the minimum sample which can reproduce the issue. The define CREATE_SCENE_EVERYTIME can switch above two cases to compare the result. Our platform is in Win10 64 bits with Qt 5.5.0.

    Could anyone help us to figure out what's happening here? Thanks.[0_1526467676059_testView.7z](Uploading 100%)


  • Moderators

    Hi @wthung, I don't think this forum supports file uploads.

    Can you create a simple example that demonstrates the memory leak? Just post the code here, no need to upload an attachment.