How to generate memory leak by QString and other implicit sharing data structure



  • QString and many data structure of Qt are implicit sharing

    How could I make their memory leak?

    Circular dependency would cause memory leak if it is shared_ptr
    Would QString and other QString like data structure in Qt memory leak too?
    I want to know how to make the memory of QString leak, so I would not fall
    into the trap of it.



  • I rarely have to deal with the problem of memory leak since we have
    stl like container, smart pointer, destructor and QObject to handle the
    memory for us.But I am still curious how could I make memory leak by
    QString like data structure in Qt.There should be some way to do it?

    QObject is the same, I always use write some codes like this
    @

    QPushButton *button = new QPushButton(this);

    @
    This is the way recommended by Qt community
    What kind of trap do it have?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.