Results 1 to 2 of 2

Thread: QString memory usage

  1. #1
    Join Date
    Dec 2007
    Posts
    40
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default QString memory usage

    Hi,
    small, stupid doubt:
    does a QString allocated on stack also store its actual contents on heap?
    i mean,
    Qt Code:
    1. f()
    2. {
    3. QString str("asdf");
    4. }
    To copy to clipboard, switch view to plain text mode 
    the actual asdf is stored on heap only right?
    For me stack is a very precious resource and so wanted to confirm this assumption before i proceed, though I guess the Implicit Sharing etc of Qt would not be possible of data also resided on stack only!!!
    Last edited by jpn; 13th December 2007 at 07:56. Reason: missing [code] tags
    Let your work talk for you

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: QString memory usage

    Nearly all Qt data types use pimpl method to store their data. Therefore all data is allocated on the heap.

  3. The following user says thank you to ChristianEhrlicher for this useful post:

    jogeshwarakundi (13th December 2007)

Similar Threads

  1. Memory usage in QTable
    By mahiapkum in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2007, 22:22
  2. QString static callback function from CURL
    By tpf80 in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 21:47
  3. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 18:59
  4. How to determine memory usage?
    By nopalot in forum General Programming
    Replies: 3
    Last Post: 11th February 2007, 20:50
  5. simple pointer question
    By mickey in forum General Programming
    Replies: 6
    Last Post: 16th June 2006, 10:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.