9
So I wanted to see what would happen to a basic Qt4 Application compiled from a simple Makefile when run through Valgrind. What would be causing these leaks? I am deleting any dynamically allocated objects on my end. Also when exiting the program I only click on the close (X) up in the upper right corner. Do GUI libs just not "free()" any of the memory they malloc()'d?
The Makefile reduced from qmake command is:
####### Compiler, tools and options
CXX = g++
CXXFLAGS = -pipe -O2 -Wall -W
LIBS_INCLUDE = ${HOME}
INCPATH = -I$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/mkspecs/default \
-I. \
-I$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/include/QtCore \
-I$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/include/QtGui \
-I$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/include
LINK = g++
LFLAGS = -Wl,-O1 -Wl,-rpath,$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/lib
LIBS = $(SUBLIBS) -L$(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/lib -lQtGui -lQtCore -lpthread
QMAKE = $(LIBS_INCLUDE)/QtSDK/Desktop/Qt/473/gcc/bin/qmake
OBJECTS_DIR = ./
SOURCES = main.cpp
OBJECTS = main.o
QMAKE_TARGET = Main
TARGET = Main
####### Build rules
first: all
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
####### Compile
main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
The only source code is:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget window;
window.resize( 320,240 );
window.setWindowTitle(
QApplication::translate( "toplevel", "Top-level Widget" ) );
window.show( );
QPushButton *button = new QPushButton(
QApplication::translate( "childwidget", "Press me"), &window );
button->move( 100, 100 );
button->show( );
delete button;