Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. create QSettings object once or when needed
Forum Updated to NodeBB v4.3 + New Features

create QSettings object once or when needed

Scheduled Pinned Locked Moved General and Desktop
qsettings
3 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ravasR Offline
    ravasR Offline
    ravas
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by
      #2

      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.

      ravasR 1 Reply Last reply
      0
      • A alex_malyu

        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.

        ravasR Offline
        ravasR Offline
        ravas
        wrote on last edited by
        #3

        @alex_malyu Thanks!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved