create QSettings object once or when needed
-
I'm working on an open source project that creates a QSettings object whenever an option needs to be saved or loaded.
I'm wondering: at what point does the creating and destroying of the object outweigh the amount of memory to keep it alive?
Do you recommend creating a QSettings object once or when needed?
-
Keeping an unneeded object in the memory is bad in general.
So if you can create such object when you need it and destroy and forget about it right after you do not need it anymore, this is preferable way to go.I would suggest always do it unless you have a performance issue related to creation /deletion of such object. I've never seen a case where this was an issue with QSettings.
-
@alex_malyu Thanks!