Function RAM usage and struct size

  • 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.


  • Moderators

    "sizeof()": for the structure.

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

  • 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.

  • Moderators

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

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

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

    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...

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.