Results 1 to 2 of 2

Thread: Mem'ries (like the corners of my mind)

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Mem'ries (like the corners of my mind)

    Guys i am wondering if QVector deleted his items when i call QVector::clear() ?

    example
    Qt Code:
    1. QVector <double> dVector;
    2. for (int i = 0 ; i < 1000000 ; i++)
    3. {
    4. dVector.append((double) i); // this loop will take atleast 1M x 4 of memory
    5. }
    6.  
    7. //now if i will say
    8. dVector.clear() // what will happen to the item created by the loop.
    To copy to clipboard, switch view to plain text mode 

    baray98

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mem'ries (like the corners of my mind)

    Check what QVector::capacity() returns and to be sure call QVector::squeeze().

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.