Results 1 to 2 of 2

Thread: QString memory usage

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

    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 06:56. Reason: missing [code] tags
    Let your work talk for you

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

    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, 21:22
  2. QString static callback function from CURL
    By tpf80 in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 20:47
  3. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  4. How to determine memory usage?
    By nopalot in forum General Programming
    Replies: 3
    Last Post: 11th February 2007, 19:50
  5. simple pointer question
    By mickey in forum General Programming
    Replies: 6
    Last Post: 16th June 2006, 09: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.