__NSAutoreleaseNoPool() warning on mac and performance
-
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 -
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.
-
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 = appCONFIG += 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...
-
Just compiling it won't make the error go away. You have to create one in you program
-
my main.cpp code is like that
@//#include <QtGui/QApplication>
#include <QtGui>
#include <QApplication>
#include "MainWindow.h"#ifdef Q_WS_MAC
#incluce "CocoaInitializer.h"
#endifint main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();#ifdef Q_WS_MAC
CocoaInitializer initializer = new CocoaInitializer();
#endifreturn a.exec();
}
@this is what you mean?
-
I would use a scope pointer so that the initializer gets properly destroyed when the program ends
-
nothing changes...
is there a possibility tha this warning affects the performance of the application or the visualization? -
The initializer must be created before any widget
-
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"
#endifint 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;
^@ -
It's include not incluce