Home > Mobile >  About a QString QByteaArray memory problems
About a QString QByteaArray memory problems

Time:09-17

QString QByteaArray data using malloc memory allocation, that if I use a QString defines a local variable, but the data is stored or in the global heap memory allocation, in this case, if frequent use QString definition, or the length of the data changes frequently, will bring a lot of memory fragments? What are the best solution?

CodePudding user response:

Change in length, every time is to release and then reapply to deallocate space, in addition, a qstring is generally not done long data preservation, if the data is very much, can consider to directly by bytearray containing preserved, ran out of the delete,
  •  Tags:  
  • Qt
  • Related