Do qDebug statements degrade app performance? - Qt



  • Hi,

    I have lot of debug statements in my Qt project. The app randomly hangs and crashes. I was wondering if the qDebug statements are degrading the app performance in any manner.

    Please suggest.

    Thanks



  • I've never had problems with qDebug at all.

    Are you sure the app isn't crashing because of bad pointers?



  • Actually i am not. Its the most likely cause but just wanted to be sure about qDebug statements. Thanks



  • qDebug statements will surely slow down the app, as all tracing / debugging statements do.
    But it should not be significally.
    If the debug statement crashes, it is typically a wrong statement or a wrong parameter.



  • Thanks Gerolf but do they even execute when I am using the app on the phone while I am not debugging?



  • They execute when you build your app with debug support enabled. As I don't know, how you build for the phone, I can't tell you.
    If debugging is disabled, they result in NOPs.



  • They execute even if you build your app in release mode. You can even reroute output using qInstallMsgHandler() to write it in file, or send it through network, etc...


  • Lifetime Qt Champion

    Hi,

    You can define QT_NO_DEBUG_OUTPUT before compiling so that qDebug does nothing


Log in to reply
 

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