Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Function RAM usage and struct size
Qt 6.11 is out! See what's new in the release blog

Function RAM usage and struct size

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 2 Posters 2.3k 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.
  • M Offline
    M Offline
    mrluzeiro
    wrote on last edited by
    #1

    Is there any way to know the size of a structure? typedef struct { ... }struct;
    And the RAM usage for a function?

    I have looking in the -Wl, ... map file but I can't find what I want.

    Thanks.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      "sizeof()":http://en.wikipedia.org/wiki/Sizeof for the structure.

      Not sure how you mean by the RAM usage for a function.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrluzeiro
        wrote on last edited by
        #3

        But sizeof only works in run time (I need to run the program to output the size of the structs).
        I think I need some debug information (generated by debug), because I can see the size of structs while in debug window.

        Also, I found this useful flag:
        QMAKE_CXXFLAGS += -fstack-usage

        it outputs the stack usage of each function.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          You didn't mention that run time wasn't what you were looking for. ;)

          What do you need the information for? (Just curious.)

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrluzeiro
            wrote on last edited by
            #5

            I'm developing a framework for help the develop of embedded systems that use QT for pre-development/deploy.

            http://code.ua.pt/projects/truefessim/wiki

            Its useful to know some statistics of how much memory I need for structures.
            In microcontrollers it isn't much memory: from 128bytes.. up to 4 .. 8K RAM...

            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