How heavy is a QObject?

I recently posted a QObject overhead question in typical use cases, but unfortunately this question was closed as a duplicate of another question that did not technically answer the question.

To make matters worse, the hasty "Samaritans" who politely hurried to close my question interrupted the answer, which I just finished typing after several tests. Since I can no longer publish my findings in my original question, I will post it here so that it is available to others who may need this information.

+7
source share
1 answer

Many people hint that QObject is heavy, but without any clarity as to how hard it is. Therefore, I made some measurements, not very accurate, all values ​​are approximate.

  • unused QObject ~ 160 bytes
  • one automatic connection without arguments ~ 235 bytes
  • 2 auto join without arguments ~ 315 bytes
  • 3 auto join, 1 with 3 arguments ~ 400 bytes
  • 2 auto-joins, 1 in the queue with 3 arguments ~ 432 bytes

These numbers should take into account that I am using the 64-bit Qt assembly.

So in conclusion, the QObject overhead is pretty significant. Nothing should be sneezed or abused.

+9
source

All Articles