Save memory by sharing data object of empty KABC::Picture objects

Review Request #110300 - Created May 4, 2013 and submitted

Information
Milian Wolff
kdepimlibs
master
Reviewers
kdepimlibs
Optimize memory consumption of KABC library for large address books.
In many cases no picture will be set for a contact yet still Picture::Private
was allocated. On my 64bit machine it has a size of 64bytes.

A common practice is to share the data member for empty objects, as is done
in most Qt classes (QString e.g.). This then saves the Picture::Private
allocation for all contacts which do not have any picture set.

Implementation detail: Sadly one cannot make it work with a private Private
class as that would not be accessible by the Q_GLOBAL_STATIC helper. Renaming
the private data class should not have any affect on the ABI though.

  
Allen Winter
Milian Wolff
Allen Winter
Christian Mollekopf
Commit Hook
Milian Wolff
Review request changed

Status: Closed (submitted)

Loading...