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. How to find the size of object instance in bytes?
Forum Updated to NodeBB v4.3 + New Features

How to find the size of object instance in bytes?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 866 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.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    Hello,

    How to get object size in memory?

    kshegunovK 1 Reply Last reply
    0
    • W WhatIf

      Hello,

      How to get object size in memory?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2
      Class object;
      std::size_t objectSize = sizeof(object);
      

      The size is in bytes. Note, however, the size's going to include any padding the compiler may have added.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      4

      • Login

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