#include <QtGui/QApplication>
#include <QTextCodec>
#include "THeapSumInfo.h"
#include "MainWindow.h"

/*------------------------------------------------------------
It looks like memory leak present in QLibrary 4.7.0.

Used Qt Creator 2.0.1 for Windows
OS - WinXP SP3 Russian,
proceccor - Athlon XP 2500, single.

The Leak reveals itself in the simple GUI application
with nested frames, then QToolButton contains Russian
text.

In this application MainWindow styleSheet is changed
cyclically by timer (set new font size), then layouts
automatically recalculated. Number of memory blocks,
calculated by _heapwalk, jumps 1000-2000 block each
several seconds, and grows unlimited. Also grows memory
usage, shown in Windows Task Manager.

If QToolButton contains English text, the problem is
not revealed, or not clearly visible by _heapwalk.

Problem revealed in both debug and release version of
program.
------------------------------------------------------------*/

int main(int argc, char *argv[])
{
    int R;
    THeapSumInfo HI1, HI2;
    THeapSumInfoDifference HIDiff;
    GetHeapSumInfo (&HI1);

    {
        QApplication a (argc, argv);
        MainWindow w;
        w.show();
        R = a.exec();
    }

    GetHeapSumInfo (&HI2);
    GetHeapSumInfoDifference (&HI1, &HI2, &HIDiff);

    SaveHeapSumInfoAndDifference (
        &HI1, &HI2, &HIDiff,
        "MemoryLeak_test.txt");

    return R;

} // ~main
