[Qt-interest] How to clear QVector without releasing memory?

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Fri Jun 17 16:19:10 CEST 2011


Hi,

I have a QVector that I want to re-use many times as a buffer. As the
application is long-running on a low memory device, memory fragmentation
might be an issue.

To keep this in check, I would like to reserve() the QVector once, with
the maximum size I am going to need, and then re-use it without ever
freeing up memory.

The only ways to clear all items from the vector I found will also
deallocate memory.

What is the performace-optimal way to clear a QVector without
deallocating memory? 


Robert Schimkowitsch

#####################################################################################
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
Thank You.
  ANDRITZ HYDRO GmbH
  Rechtsform/ Legal form: Gesellschaft mit beschrankter Haftung / Corporation 
  Firmensitz/ Registered seat: Wien 
  Firmenbuchgericht/ Court of registry: Handelsgericht Wien 
  Firmenbuchnummer/ Company registration: FN 61833 g
  DVR: 0605077 
  UID-Nr.: ATU14756806
#####################################################################################

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110617/fdd0ee73/attachment.html 


More information about the Qt-interest-old mailing list