Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Object property memory management

Object property memory management

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 416 Views
  • 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.
  • A Offline
    A Offline
    Archie888
    wrote on last edited by Archie888
    #1

    Hi,

    If I have some object, Item or QtObject as a property of a QML element (let's say Item as the container, but I am also interested in the situation, when the containing object is QtObject), how is the memory management done?

    Think about these following situations:

    1:    property var someObject: { "key" : "value" }
    
    2:    property Item someItem: Item { ... }
    
    3:    property QtObject someQtObject: QtObject { ... }
    

    Will the containing element be the objects' parent? Will the memory of the property object be released, when the parent gets destroyed? Is this actually not a good thing to do, and might lead to memory leaks, unless the properties are deleted or released in code? And so on. Any insights?

    Also, would it be beneficial to do something like this:

    4:    property Item someItem: Item {
               parent: containingElementId
               ...
          }
    

    I have sometimes the need to do things such as here, and not simply configure the object to be under the children default property of an item. Also, when the containing object is QtObject, there is no children default property, but memory still needs to be managed.

    Thanks,
    -A888

    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