Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. __NSAutoreleaseNoPool() warning on mac and performance
Forum Updated to NodeBB v4.3 + New Features

__NSAutoreleaseNoPool() warning on mac and performance

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 2 Posters 4.5k 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.
  • S Offline
    S Offline
    salvador
    wrote on last edited by
    #1

    Hi,
    i have a tone of these wanrings:
    @2013-03-28 10:13:49.502 QtGrid[12973:903] *** __NSAutoreleaseNoPool(): Object 0x1014088b0 of class __NSCFType autoreleased with no pool in place - just leaking
    @
    @2013-03-28 10:13:49.507 QtGrid[12973:903] *** __NSAutoreleaseNoPool(): Object 0x1010060c0 of class NSCFNumber autoreleased with no pool in place - just leaking
    @
    @2013-03-28 10:13:49.509 QtGrid[12973:903] *** __NSAutoreleaseNoPool(): Object 0x101019ec0 of class NSCFDictionary autoreleased with no pool in place - just leaking
    @
    @2013-03-28 10:13:49.509 QtGrid[12973:903] *** __NSAutoreleaseNoPool(): Object 0x7fff710b1c68 of class NSCFString autoreleased with no pool in place - just leaking
    @
    @2013-03-28 10:13:49.517 QtGrid[12973:903] *** __NSAutoreleaseNoPool(): Object 0x10150adc0 of class __NSFontTypefaceInfo autoreleased with no pool in place - just leaking
    @

    As far as i know this is an unsolved bug in mac osx versions of Qt.
    My application is extremely slow and i want to know if the problem is my programming or the bug that causes memory leak.
    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You need to create an autorelease pool at the startup of your program. Search for CocoaInitializer, that will get you some examples on how to do it.

      Hope it helps.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        salvador
        wrote on last edited by
        #3

        i put the CocoaInitializer.h and CocoaInitializer.mm in my project file and i change my pro file. Now it is
        @#-------------------------------------------------

        Project created by QtCreator 2012-11-29T14:32:10

        #-------------------------------------------------

        QT += core gui\

        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

        TARGET = QtGrid
        TEMPLATE = app

        CONFIG += x86_64

        SOURCES += main.cpp
        MainWindow.cpp
        DataCacher.cpp
        Server.cpp
        Structs.cpp
        VDatagridView.cpp \

        OBJECTIVE_SOURCES += Cocoainitializer.mm

        HEADERS += MainWindow.h
        DataCacher.h
        Server.h
        Structs.h
        VDatagridView.h \

        OBJECTIVE_HEADERS += Cocoainitializer.h

        FORMS += MainWindow.ui
        VDatagridView.ui

        @

        What else do i have to do because the warnings still exist...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Just compiling it won't make the error go away. You have to create one in you program

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            salvador
            wrote on last edited by
            #5

            my main.cpp code is like that
            @//#include <QtGui/QApplication>
            #include <QtGui>
            #include <QApplication>
            #include "MainWindow.h"

            #ifdef Q_WS_MAC
            #incluce "CocoaInitializer.h"
            #endif

            int main(int argc, char *argv[])
            {
            QApplication a(argc, argv);
            MainWindow w;
            w.show();

            #ifdef Q_WS_MAC
            CocoaInitializer initializer = new CocoaInitializer();
            #endif

            return a.exec();
            }
            @

            this is what you mean?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              I would use a scope pointer so that the initializer gets properly destroyed when the program ends

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • S Offline
                S Offline
                salvador
                wrote on last edited by
                #7

                nothing changes...
                is there a possibility tha this warning affects the performance of the application or the visualization?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  The initializer must be created before any widget

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    salvador
                    wrote on last edited by
                    #9

                    Sorry for the number of quetion but i am new to c++ and qt developing. My main class code is as follows:
                    @//#include <QtGui/QApplication>
                    #include <QtGui>
                    #include <QApplication>
                    #include "MainWindow.h"
                    #define Q_WS_MAC

                    #ifdef Q_WS_MAC
                    #incluce "CocoaInitializer.h"
                    #endif

                    int main(int argc, char argv[])
                    {
                    #ifdef Q_WS_MAC
                    CocoaInitializer
                    initializer;
                    #endif
                    QApplication a(argc, argv);
                    MainWindow w;
                    w.show();
                    return a.exec();
                    }
                    @

                    and i get the following errors
                    @/Users/smpeis/Documents/Intership/Experiments/GridQt/QtGrid/main.cpp:8: error: invalid preprocessing directive
                    #incluce "CocoaInitializer.h"
                    ^@
                    @/Users/smpeis/Documents/Intership/Experiments/GridQt/QtGrid/main.cpp:14: error: use of undeclared identifier 'CocoaInitializer'
                    CocoaInitializer* initializer;
                    ^@
                    @/Users/smpeis/Documents/Intership/Experiments/GridQt/QtGrid/main.cpp:14: error: use of undeclared identifier 'initializer'
                    CocoaInitializer* initializer;
                    ^@

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      It's include not incluce

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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