I am currently in the process of optimizing my program for runtime memory usage. I have a bunch of locations where I am writing to a file and know the filepath already. Thats why I defined the literals as following:
const QString BLUE_LED = "/sys/class/leds/main:blue/trigger";
I can optimize this to be inlined better by doing this:
const char* const BLUE_LED = "/sys/class/leds/main:blue/trigger";
I am using this literal with the class QFile which has those constructors:
QFile(const QString &name, QObject *parent)QFile(QObject *parent)QFile(const QString &name)
Compiler flags I am using:
-c -pipe -O2 -pipe -g -feliminate-unused-debug-types
I suspect that the overall filesize will be going down but, the memory usage will increase for a fraction of a moment because in order to construct a QFile an intermediate QString will be constructed from the const char* const
. Is this assumption correct? Is there a way to keep track of those impliciting constructions somehow, other then monitoring the programs memory usage?