2

I am trying to locate the memory leaks in my Qt application. I already have used Visual Leak Detector for some other projects, but VLD writes the output to the console window.

My problem now is that when using a QApplication, no console window, and therefore no output from VLD, is shown. I am using Visual Studio 2015 with the Qt VS Tools plugin.

Is there a way to force the application to show the console window? Or maybe a way to write the output generated by VLD to a file?

How I start up my application:

#include "mainwindow.h"

#include <vld.h>
#include <QApplication>

int main(int argc, char *argv[]) {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
karposhark
  • 321
  • 1
  • 2
  • 11
  • Possible duplicate of [Console output in a Qt GUI app?](http://stackoverflow.com/questions/3360548/console-output-in-a-qt-gui-app) – KjMag May 19 '17 at 13:14
  • 1
    According to the [VLD documentation](https://vld.codeplex.com/wikipage?title=Configuration%20Options&referringTitle=Documentation), you should set the `ReportTo` and `ReportFile` options in vld.ini. – ssbssa May 19 '17 at 16:38
  • @ssbssa Thank you! That solved my problem. – karposhark May 19 '17 at 17:31

1 Answers1

1

As ssbssa pointed out as a comment, the problem could be solved by setting ReportTo and ReportFile in vld.ini found in the installation folder of VLD:

  1. change ReportFile = to ReportFile = memory_leak_report.txt or something like that.

  2. change ReportTo = debugger to ReportTo = file or ReportTo = both.

Now the output produced by VLD will be written to the specified file.

karposhark
  • 321
  • 1
  • 2
  • 11