Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:31:18+00:00 2026-06-15T20:31:18+00:00

QString and many data structure of Qt are implicit sharing How could I make

  • 0

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.

After some study, looks like I don’t have to worry about circular dependency when
it is QString? Thanks to your reply, now I don’t have to worry about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:31:20+00:00Added an answer on June 15, 2026 at 8:31 pm

    In versions of Qt prior to 4 concurrent access to two copies of a QString which shared the same data could cause problems because QString is COW but did not lock the ref count. This was a gotcha. As of version 4 the ref count is handled using atomics which solves the problem.
    You can mangle some Qt containers by putting things in them that can throw in odd places but I can’t think of a way that could affect QString. Be warry of exception handling in Qt, the doc’s are quite vague which usually means beware 😉

    http://doc-snapshot.qt-project.org/4.8/exceptionsafety.html

    If you run out of memory when running Qt expect the world to end, in that case it’s probably doesn’t matter if the QString leaked or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I copy data from a Qstring list to a text file for
I need to replace characters in a QString based on their QChar::category . In
I am not sure if the following code is safe from memory leak. #ifndef
From debugger in my string of arrays I am getting this: "/mercedes-benz/190-class/1993/" class="canonicalLink" data-qstring="?sub=sedan">1993
I filled a QString object with Unicode data and tried to send it with
I have a QString that I would like to convert into a char* not
I would like to covert a QString into either a utf8 or a latin1
What advantages does QString offer over std::string? Can a normal std::string store unicode characters
I have a QString. I need to create a copy of this QString. In
I have the following: QString html = ui->DetailsTextBrowser->document()->toHtml(); html = details.replace(#VERSION, 1.0); ui->DetailsTextBrowser->document()->setHtml(details); Unfortunately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.