Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to generate memory leak by QString and other implicit sharing data structure
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved