Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSoundEffect memory usage increasing over time
QtWS25 Last Chance

QSoundEffect memory usage increasing over time

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsoundeffectmemoryqtmultimedia
11 Posts 3 Posters 3.9k Views
  • 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.
  • R Offline
    R Offline
    robcreamer
    wrote on last edited by robcreamer
    #1

    I have an application that uses QSoundEffect in a worker thread. Over time, the heap grows although new allocations are not apparent in the code. The application has to run indefinitely, so the memory usage over time will eventually result in running out of memory.

    The application uses Qt 5.7.1. I created a sample program to reproduce the problem. Is there something that I can do to free up some of this requested memory?

    Command run on CentOS 7 with Kernel 4.4.60 RT PREEMPT built from kernel.org:

    $ valgrind --tool=massif --threshold=0.001 --time-unit=ms ./SoundEffectLeak
    

    I ran the sample program for roughly 2 hours. The heap profile showed an increase in requested memory of about 67k. I don't have permissions to upload these files.

    ms_print output

    --------------------------------------------------------------------------------
    Command:            ./SoundEffectLeak
    Massif arguments:   --threshold=0.001 --time-unit=ms
    ms_print arguments: massif.out.11536
    --------------------------------------------------------------------------------
    
    
        MB
    13.28^                                                                       :
         |#::@:::::@::::@:::::::@:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
       0 +----------------------------------------------------------------------->h
         0                                                                   1.856
    
    Number of snapshots: 83
     Detailed snapshots: [1 (peak), 4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 59, 69, 79]
    
    --------------------------------------------------------------------------------
      n       time(ms)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
    --------------------------------------------------------------------------------
      0              0                0                0             0            0
      1          2,413       13,822,296       13,501,209       321,087            0
      2        132,062       13,807,576       13,485,696       321,880            0
      3        224,064       13,810,760       13,488,105       322,655            0
      4        360,062       13,811,776       13,488,508       323,268            0
      5        460,063       13,814,464       13,490,564       323,900            0
      6        527,063       13,815,640       13,491,264       324,376            0
      7        639,063       13,817,408       13,492,364       325,044            0
      8        751,063       13,819,224       13,493,464       325,760            0
      9        870,063       13,823,176       13,496,712       326,464            0
     10        966,063       13,824,776       13,497,712       327,064            0
     11      1,062,063       13,827,528       13,499,629       327,899            0
     12      1,158,063       13,829,328       13,500,709       328,619            0
     13      1,254,063       13,830,936       13,501,797       329,139            0
     14      1,350,063       13,832,592       13,502,841       329,751            0
     15      1,446,063       13,834,152       13,503,765       330,387            0
     16      1,590,063       13,836,336       13,505,097       331,239            0
     17      1,750,063       13,842,992       13,510,793       332,199            0
     18      1,910,063       13,845,472       13,512,393       333,079            0
     19      2,070,063       13,848,112       13,513,993       334,119            0
     20      2,150,063       13,850,000       13,515,282       334,718            0
     21      2,230,063       13,850,840       13,515,665       335,175            0
     22      2,310,063       13,852,088       13,516,473       335,615            0
     23      2,390,063       13,853,696       13,517,489       336,207            0
     24      2,470,063       13,856,800       13,520,033       336,767            0
     25      2,550,063       13,855,920       13,518,793       337,127            0
     26      2,630,063       13,857,280       13,519,593       337,687            0
     27      2,710,063       13,858,544       13,520,393       338,151            0
     28      2,790,063       13,861,432       13,522,593       338,839            0
     29      2,870,063       13,861,136       13,521,993       339,143            0
     30      2,950,063       13,862,464       13,522,793       339,671            0
     31      3,030,063       13,863,744       13,523,593       340,151            0
     32      3,110,063       13,865,056       13,524,393       340,663            0
     33      3,190,063       13,866,352       13,525,193       341,159            0
     34      3,270,063       13,867,680       13,525,993       341,687            0
     35      3,350,063       13,868,992       13,526,793       342,199            0
     36      3,430,063       13,878,816       13,536,081       342,735            0
     37      3,510,063       13,879,696       13,536,585       343,111            0
     38      3,590,063       13,881,096       13,537,453       343,643            0
     39      3,670,063       13,884,464       13,540,225       344,239            0
     40      3,750,063       13,883,624       13,539,013       344,611            0
     41      3,830,063       13,886,120       13,540,782       345,338            0
     42      3,910,063       13,886,208       13,540,585       345,623            0
     43      3,990,063       13,887,744       13,541,585       346,159            0
     44      4,070,063       13,888,784       13,542,185       346,599            0
     45      4,150,063       13,890,280       13,543,114       347,166            0
     46      4,230,063       13,891,328       13,543,785       347,543            0
     47      4,310,063       13,892,792       13,544,714       348,078            0
     48      4,390,063       13,893,872       13,545,385       348,487            0
     49      4,470,063       13,895,104       13,546,185       348,919            0
     50      4,537,063       13,896,216       13,546,885       349,331            0
     51      4,604,063       13,897,344       13,547,585       349,759            0
     52      4,671,063       13,898,272       13,548,185       350,087            0
     53      4,738,063       13,899,904       13,549,301       350,603            0
     54      4,805,063       13,900,480       13,549,585       350,895            0
     55      4,872,063       13,901,440       13,550,185       351,255            0
     56      4,939,063       13,902,536       13,550,885       351,651            0
     57      5,006,063       13,903,664       13,551,585       352,079            0
     58      5,073,063       13,904,744       13,552,285       352,459            0
     59      5,140,063       13,905,816       13,552,957       352,859            0
     60      5,207,063       13,906,840       13,553,617       353,223            0
     61      5,274,063       13,908,088       13,554,389       353,699            0
     62      5,341,063       13,908,856       13,554,885       353,971            0
     63      5,408,063       13,910,144       13,555,689       354,455            0
     64      5,475,063       13,911,080       13,556,285       354,795            0
     65      5,542,063       13,912,040       13,556,885       355,155            0
     66      5,609,063       13,913,136       13,557,585       355,551            0
     67      5,676,063       13,914,320       13,558,315       356,005            0
     68      5,743,063       13,915,344       13,558,985       356,359            0
     69      5,810,063       13,917,168       13,560,345       356,823            0
     70      5,877,063       13,917,416       13,560,285       357,131            0
     71      5,944,063       13,918,544       13,560,985       357,559            0
     72      6,011,063       13,919,704       13,561,753       357,951            0
     73      6,078,063       13,920,616       13,562,285       358,331            0
     74      6,145,063       13,921,664       13,562,985       358,679            0
     75      6,212,063       13,922,704       13,563,617       359,087            0
     76      6,279,063       13,923,720       13,564,285       359,435            0
     77      6,346,063       13,924,848       13,564,985       359,863            0
     78      6,413,063       13,925,928       13,565,685       360,243            0
     79      6,480,063       13,926,936       13,566,285       360,651            0
     80      6,547,063       13,927,984       13,566,985       360,999            0
     81      6,614,063       13,929,112       13,567,685       361,427            0
     82      6,681,063       13,930,040       13,568,285       361,755            0
    
    

    Boilerplate .pro file.

    soundeffectleak.pro

    #-------------------------------------------------
    #
    # Project created by QtCreator 2017-10-19T10:05:20
    #
    #-------------------------------------------------
    
    QT       += core gui multimedia
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = SoundEffectLeak
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    
    SOURCES += \
    		main.cpp \
    		mainwindow.cpp \
    	audioworker.cpp
    
    HEADERS += \
    		mainwindow.h \
    	audioworker.h
    
    
    
    

    main.cpp

    #include "mainwindow.h"
    #include <QApplication>
    #include <QThread>
    
    #include "audioworker.h"
    
    int main(int argc, char *argv[])
    {
    	QApplication a(argc, argv);
    
            /* Just show a timer of how long it has been running. */
    	MainWindow w;
    	w.show();
    
            /* Create the sound effect in a separate thread */
    	QThread *thread = new QThread(&w);
    	AudioWorker *worker = new AudioWorker;
    	a.connect(thread, SIGNAL(started()), worker, SLOT(doStart()),
    			  Qt::QueuedConnection);
    	worker->moveToThread(thread);
    	thread->start();
    
    
    	return a.exec();
    }
    

    audioworker.h

    #ifndef AUDIOWORKER_H
    #define AUDIOWORKER_H
    
    #include <QObject>
    #include <QSoundEffect>
    
    class AudioWorker : public QObject
    {
    	Q_OBJECT
    public:
    	explicit AudioWorker(QObject *parent = nullptr);
    
    signals:
    
    public slots:
    	void doStart();
    private:
    	QSoundEffect *sound;
    private slots:
    	void checkStatus();
    };
    
    #endif // AUDIOWORKER_H
    

    audioworker.cpp

    #include "audioworker.h"
    #include <QDebug>
    AudioWorker::AudioWorker(QObject *parent) : QObject(parent)
    {
    }
    
    void AudioWorker::doStart()
    {
            /* Supply your own wav file. Load it, but never play it */
    	sound = new QSoundEffect(this);
    	sound->setSource(QUrl::fromLocalFile("mywav.wav")); 
    
            /* Check for errors */
    	connect(sound, SIGNAL(statusChanged()), SLOT(checkStatus()));
    }
    
    void AudioWorker::checkStatus()
    {
    	if (sound->status() == QSoundEffect::Error) {
    		qDebug() << "Error";
    	}
    }
    

    mainwindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include <QLabel>
    
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
    	Q_OBJECT
    
    public:
    	explicit MainWindow(QWidget *parent = 0);
    	~MainWindow();
    
    private:
    	QLabel *label;
    	int runtime;
    
    private slots:
    	void incrementTime();
    };
    
    #endif // MAINWINDOW_H
    

    mainwindow.cpp

    #include "mainwindow.h"
    
    #include <QTimer>
    #include <QTime>
    
    
    MainWindow::MainWindow(QWidget *parent) :
    	QMainWindow(parent)
    {
    	runtime = 0;
    
            /* This just makes it easy to see how long it has run */
    	label = new QLabel(this);
    	setCentralWidget(label);
    
    	QTimer *timer = new QTimer(this);
    	connect(timer, SIGNAL(timeout()), SLOT(incrementTime()));
    	timer->start(1000);
    }
    
    MainWindow::~MainWindow()
    {
    }
    
    void MainWindow::incrementTime()
    {
    	static const QString FORMAT("Runtime: %1");
    
    	runtime++;
    
    	QTime time = QTime::fromMSecsSinceStartOfDay(runtime * 1000);
    
    	QString timeText(time.toString(Qt::TextDate));
    
    	label->setText(FORMAT.arg(timeText));
    
    
    }
    
    R 1 Reply Last reply
    0
    • R robcreamer

      I have an application that uses QSoundEffect in a worker thread. Over time, the heap grows although new allocations are not apparent in the code. The application has to run indefinitely, so the memory usage over time will eventually result in running out of memory.

      The application uses Qt 5.7.1. I created a sample program to reproduce the problem. Is there something that I can do to free up some of this requested memory?

      Command run on CentOS 7 with Kernel 4.4.60 RT PREEMPT built from kernel.org:

      $ valgrind --tool=massif --threshold=0.001 --time-unit=ms ./SoundEffectLeak
      

      I ran the sample program for roughly 2 hours. The heap profile showed an increase in requested memory of about 67k. I don't have permissions to upload these files.

      ms_print output

      --------------------------------------------------------------------------------
      Command:            ./SoundEffectLeak
      Massif arguments:   --threshold=0.001 --time-unit=ms
      ms_print arguments: massif.out.11536
      --------------------------------------------------------------------------------
      
      
          MB
      13.28^                                                                       :
           |#::@:::::@::::@:::::::@:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
           |#::@::: :@::::@: :: : @:::@:::@::::@:::@:::@::::@::::::@::::::@::::::@::
         0 +----------------------------------------------------------------------->h
           0                                                                   1.856
      
      Number of snapshots: 83
       Detailed snapshots: [1 (peak), 4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 59, 69, 79]
      
      --------------------------------------------------------------------------------
        n       time(ms)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
      --------------------------------------------------------------------------------
        0              0                0                0             0            0
        1          2,413       13,822,296       13,501,209       321,087            0
        2        132,062       13,807,576       13,485,696       321,880            0
        3        224,064       13,810,760       13,488,105       322,655            0
        4        360,062       13,811,776       13,488,508       323,268            0
        5        460,063       13,814,464       13,490,564       323,900            0
        6        527,063       13,815,640       13,491,264       324,376            0
        7        639,063       13,817,408       13,492,364       325,044            0
        8        751,063       13,819,224       13,493,464       325,760            0
        9        870,063       13,823,176       13,496,712       326,464            0
       10        966,063       13,824,776       13,497,712       327,064            0
       11      1,062,063       13,827,528       13,499,629       327,899            0
       12      1,158,063       13,829,328       13,500,709       328,619            0
       13      1,254,063       13,830,936       13,501,797       329,139            0
       14      1,350,063       13,832,592       13,502,841       329,751            0
       15      1,446,063       13,834,152       13,503,765       330,387            0
       16      1,590,063       13,836,336       13,505,097       331,239            0
       17      1,750,063       13,842,992       13,510,793       332,199            0
       18      1,910,063       13,845,472       13,512,393       333,079            0
       19      2,070,063       13,848,112       13,513,993       334,119            0
       20      2,150,063       13,850,000       13,515,282       334,718            0
       21      2,230,063       13,850,840       13,515,665       335,175            0
       22      2,310,063       13,852,088       13,516,473       335,615            0
       23      2,390,063       13,853,696       13,517,489       336,207            0
       24      2,470,063       13,856,800       13,520,033       336,767            0
       25      2,550,063       13,855,920       13,518,793       337,127            0
       26      2,630,063       13,857,280       13,519,593       337,687            0
       27      2,710,063       13,858,544       13,520,393       338,151            0
       28      2,790,063       13,861,432       13,522,593       338,839            0
       29      2,870,063       13,861,136       13,521,993       339,143            0
       30      2,950,063       13,862,464       13,522,793       339,671            0
       31      3,030,063       13,863,744       13,523,593       340,151            0
       32      3,110,063       13,865,056       13,524,393       340,663            0
       33      3,190,063       13,866,352       13,525,193       341,159            0
       34      3,270,063       13,867,680       13,525,993       341,687            0
       35      3,350,063       13,868,992       13,526,793       342,199            0
       36      3,430,063       13,878,816       13,536,081       342,735            0
       37      3,510,063       13,879,696       13,536,585       343,111            0
       38      3,590,063       13,881,096       13,537,453       343,643            0
       39      3,670,063       13,884,464       13,540,225       344,239            0
       40      3,750,063       13,883,624       13,539,013       344,611            0
       41      3,830,063       13,886,120       13,540,782       345,338            0
       42      3,910,063       13,886,208       13,540,585       345,623            0
       43      3,990,063       13,887,744       13,541,585       346,159            0
       44      4,070,063       13,888,784       13,542,185       346,599            0
       45      4,150,063       13,890,280       13,543,114       347,166            0
       46      4,230,063       13,891,328       13,543,785       347,543            0
       47      4,310,063       13,892,792       13,544,714       348,078            0
       48      4,390,063       13,893,872       13,545,385       348,487            0
       49      4,470,063       13,895,104       13,546,185       348,919            0
       50      4,537,063       13,896,216       13,546,885       349,331            0
       51      4,604,063       13,897,344       13,547,585       349,759            0
       52      4,671,063       13,898,272       13,548,185       350,087            0
       53      4,738,063       13,899,904       13,549,301       350,603            0
       54      4,805,063       13,900,480       13,549,585       350,895            0
       55      4,872,063       13,901,440       13,550,185       351,255            0
       56      4,939,063       13,902,536       13,550,885       351,651            0
       57      5,006,063       13,903,664       13,551,585       352,079            0
       58      5,073,063       13,904,744       13,552,285       352,459            0
       59      5,140,063       13,905,816       13,552,957       352,859            0
       60      5,207,063       13,906,840       13,553,617       353,223            0
       61      5,274,063       13,908,088       13,554,389       353,699            0
       62      5,341,063       13,908,856       13,554,885       353,971            0
       63      5,408,063       13,910,144       13,555,689       354,455            0
       64      5,475,063       13,911,080       13,556,285       354,795            0
       65      5,542,063       13,912,040       13,556,885       355,155            0
       66      5,609,063       13,913,136       13,557,585       355,551            0
       67      5,676,063       13,914,320       13,558,315       356,005            0
       68      5,743,063       13,915,344       13,558,985       356,359            0
       69      5,810,063       13,917,168       13,560,345       356,823            0
       70      5,877,063       13,917,416       13,560,285       357,131            0
       71      5,944,063       13,918,544       13,560,985       357,559            0
       72      6,011,063       13,919,704       13,561,753       357,951            0
       73      6,078,063       13,920,616       13,562,285       358,331            0
       74      6,145,063       13,921,664       13,562,985       358,679            0
       75      6,212,063       13,922,704       13,563,617       359,087            0
       76      6,279,063       13,923,720       13,564,285       359,435            0
       77      6,346,063       13,924,848       13,564,985       359,863            0
       78      6,413,063       13,925,928       13,565,685       360,243            0
       79      6,480,063       13,926,936       13,566,285       360,651            0
       80      6,547,063       13,927,984       13,566,985       360,999            0
       81      6,614,063       13,929,112       13,567,685       361,427            0
       82      6,681,063       13,930,040       13,568,285       361,755            0
      
      

      Boilerplate .pro file.

      soundeffectleak.pro

      #-------------------------------------------------
      #
      # Project created by QtCreator 2017-10-19T10:05:20
      #
      #-------------------------------------------------
      
      QT       += core gui multimedia
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = SoundEffectLeak
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      
      SOURCES += \
      		main.cpp \
      		mainwindow.cpp \
      	audioworker.cpp
      
      HEADERS += \
      		mainwindow.h \
      	audioworker.h
      
      
      
      

      main.cpp

      #include "mainwindow.h"
      #include <QApplication>
      #include <QThread>
      
      #include "audioworker.h"
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      
              /* Just show a timer of how long it has been running. */
      	MainWindow w;
      	w.show();
      
              /* Create the sound effect in a separate thread */
      	QThread *thread = new QThread(&w);
      	AudioWorker *worker = new AudioWorker;
      	a.connect(thread, SIGNAL(started()), worker, SLOT(doStart()),
      			  Qt::QueuedConnection);
      	worker->moveToThread(thread);
      	thread->start();
      
      
      	return a.exec();
      }
      

      audioworker.h

      #ifndef AUDIOWORKER_H
      #define AUDIOWORKER_H
      
      #include <QObject>
      #include <QSoundEffect>
      
      class AudioWorker : public QObject
      {
      	Q_OBJECT
      public:
      	explicit AudioWorker(QObject *parent = nullptr);
      
      signals:
      
      public slots:
      	void doStart();
      private:
      	QSoundEffect *sound;
      private slots:
      	void checkStatus();
      };
      
      #endif // AUDIOWORKER_H
      

      audioworker.cpp

      #include "audioworker.h"
      #include <QDebug>
      AudioWorker::AudioWorker(QObject *parent) : QObject(parent)
      {
      }
      
      void AudioWorker::doStart()
      {
              /* Supply your own wav file. Load it, but never play it */
      	sound = new QSoundEffect(this);
      	sound->setSource(QUrl::fromLocalFile("mywav.wav")); 
      
              /* Check for errors */
      	connect(sound, SIGNAL(statusChanged()), SLOT(checkStatus()));
      }
      
      void AudioWorker::checkStatus()
      {
      	if (sound->status() == QSoundEffect::Error) {
      		qDebug() << "Error";
      	}
      }
      

      mainwindow.h

      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QMainWindow>
      #include <QLabel>
      
      namespace Ui {
      class MainWindow;
      }
      
      class MainWindow : public QMainWindow
      {
      	Q_OBJECT
      
      public:
      	explicit MainWindow(QWidget *parent = 0);
      	~MainWindow();
      
      private:
      	QLabel *label;
      	int runtime;
      
      private slots:
      	void incrementTime();
      };
      
      #endif // MAINWINDOW_H
      

      mainwindow.cpp

      #include "mainwindow.h"
      
      #include <QTimer>
      #include <QTime>
      
      
      MainWindow::MainWindow(QWidget *parent) :
      	QMainWindow(parent)
      {
      	runtime = 0;
      
              /* This just makes it easy to see how long it has run */
      	label = new QLabel(this);
      	setCentralWidget(label);
      
      	QTimer *timer = new QTimer(this);
      	connect(timer, SIGNAL(timeout()), SLOT(incrementTime()));
      	timer->start(1000);
      }
      
      MainWindow::~MainWindow()
      {
      }
      
      void MainWindow::incrementTime()
      {
      	static const QString FORMAT("Runtime: %1");
      
      	runtime++;
      
      	QTime time = QTime::fromMSecsSinceStartOfDay(runtime * 1000);
      
      	QString timeText(time.toString(Qt::TextDate));
      
      	label->setText(FORMAT.arg(timeText));
      
      
      }
      
      R Offline
      R Offline
      robcreamer
      wrote on last edited by
      #2

      Updated with some OS information. Added some comments.

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        Since you provided a runnable sample, i tried in on win 10, vs compiler2015, Qt5.9

        I could not detect any increase in memory.
        Even tried a more fine grained reporter but the memory seems to stay
        steady.

        alt text

        Ill let it run for some hours more and see.

        Ready to run project for other that might have time for a test
        https://www.dropbox.com/s/4krk1rpv0virff9/QSoundEffectTest.zip?dl=0

        R 1 Reply Last reply
        0
        • R Offline
          R Offline
          robcreamer
          wrote on last edited by
          #4

          Update: I ran the program for a 122.7 hours and produced the information below. I
          included the first and last detailed snapshot. Notice the increases in memory
          attributed to heap allocation.

          --------------------------------------------------------------------------------
          Command:            ./SoundEffectLeak
          Massif arguments:   --threshold=0.001 --time-unit=ms
          ms_print arguments: massif.out.9878
          --------------------------------------------------------------------------------
          
          
              MB
          15.00^                                                                       #
               |                                                                       #
               |                                                                       #
               |                                                                    :@@#
               |                                                            :@@@:@@:@@@#
               |                                                   ::@:::::@:@@@:@@:@@@#
               |                                           ::@::@::: @:::::@:@@@:@@:@@@#
               |                                   @::@@::@::@: @::: @:::::@:@@@:@@:@@@#
               |                                @@@@::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |                        ::::::::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |                 ::::@:::::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |           :::@:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |    @@::::@:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |::::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
               |: ::@@: : @:: @:::: :@: :::: :::@@ @::@ : @::@: @::: @:::::@:@@@:@@:@@@#
             0 +----------------------------------------------------------------------->h
               0                                                                   122.7
          
          Number of snapshots: 68
           Detailed snapshots: [4, 5, 8, 11, 17, 26, 27, 28, 31, 33, 36, 38, 42, 48, 51, 53, 55, 57, 59, 61, 63, 65, 66 (peak)]
          
          --------------------------------------------------------------------------------
            n       time(ms)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
          --------------------------------------------------------------------------------
            0              0                0                0             0            0
            1      5,772,784        5,923,360        5,650,397       272,963            0
            2     13,843,784        6,095,744        5,780,349       315,395            0
            3     19,521,784        6,182,664        5,837,049       345,615            0
            4     29,482,784        6,399,592        6,002,185       397,407            0
          93.79% (6,002,185B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
          ->45.94% (2,940,039B) 0x65203EE: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->02.08% (132,864B) 0x66EC6B0: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | ->02.06% (131,840B) 0x66EC8B3: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | ->02.06% (131,840B) 0x66E818C: QCoreApplication::postEvent(QObject*, QEvent*, int) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | ->02.06% (131,712B) 0x670DCD4: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | ->02.05% (131,072B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | | | | | ->02.05% (131,072B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | | | | |   ->02.05% (131,072B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |     ->02.05% (131,072B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |       ->02.05% (131,072B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |         ->02.05% (131,072B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |           ->02.05% (131,072B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |             ->02.05% (131,072B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |               ->02.05% (131,072B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |                 ->02.05% (131,072B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                   ->02.05% (131,072B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                     ->02.05% (131,072B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                       ->02.05% (131,072B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                         ->02.05% (131,072B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | | | | | |                           ->02.05% (131,072B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | | | | | |                             
          | | | | | ->00.01% (640B) in 3+ places, all below ms_print's threshold (01.00%)
          | | | | | 
          | | | | ->00.00% (128B) in 2+ places, all below ms_print's threshold (01.00%)
          | | | | 
          | | | ->00.00% (0B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | 
          | | ->00.02% (1,024B) in 1+ places, all below ms_print's threshold (01.00%)
          | | 
          | ->02.52% (161,150B) in 33+ places, all below ms_print's threshold (01.00%)
          ->07.22% (461,962B) 0x19087650: ??? (in /usr/lib64/dri/i965_dri.so)
          | ->06.91% (441,892B) 0x190876AC: ??? (in /usr/lib64/dri/i965_dri.so)
          | | ->05.98% (382,476B) 0x18FF5910: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | ->05.74% (367,312B) 0x19118A05: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | ->04.48% (286,836B) 0x19118E6C: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | | ->04.48% (286,836B) 0x190CA81E: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | |   ->04.48% (286,836B) 0x19088EEE: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | |     ->04.48% (286,836B) 0x6BDAD9F: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | | |       ->04.48% (286,836B) 0x6BB02D7: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | | |         ->04.48% (286,836B) 0x6BAC4C5: glXGetFBConfigs (in /usr/lib64/libGL.so.1.2.0)
          | | | | |           ->04.48% (286,836B) 0x6BAD064: glXChooseFBConfig (in /usr/lib64/libGL.so.1.2.0)
          | | | | |             ->04.48% (286,836B) 0x187B3525: ???
          | | | | |               ->04.48% (286,836B) 0x187B384B: ???
          | | | | |                 ->04.48% (286,836B) 0x187B0157: ???
          | | | | |                   ->04.48% (286,836B) 0x164D5CFF: ???
          | | | | |                     ->04.48% (286,836B) 0x164C0F7E: ???
          | | | | |                       ->04.48% (286,836B) 0x5A84469: QWindowPrivate::create(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Gui.so.5.7.1)
          | | | | |                         ->04.48% (286,836B) 0x52C733B: QWidgetPrivate::create_sys(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                           ->04.48% (286,836B) 0x52C6B07: QWidget::create(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                             ->04.48% (286,836B) 0x52D3330: QWidget::setVisible(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                               ->04.48% (286,836B) 0x403422: main (main.cpp:11)
          | | | | |                                 
          | | | | ->01.26% (80,476B) 0x190CA81E: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | |   ->01.26% (80,476B) 0x19088EEE: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | |     ->01.26% (80,476B) 0x6BDAD9F: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | |       ->01.26% (80,476B) 0x6BB02D7: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | |         ->01.26% (80,476B) 0x6BAC4C5: glXGetFBConfigs (in /usr/lib64/libGL.so.1.2.0)
          | | | |           ->01.26% (80,476B) 0x6BAD064: glXChooseFBConfig (in /usr/lib64/libGL.so.1.2.0)
          | | | |             ->01.26% (80,476B) 0x187B3525: ???
          | | | |               ->01.26% (80,476B) 0x187B384B: ???
          | | | |                 ->01.26% (80,476B) 0x187B0157: ???
          | | | |                   ->01.26% (80,476B) 0x164D5CFF: ???
          | | | |                     ->01.26% (80,476B) 0x164C0F7E: ???
          | | | |                       ->01.26% (80,476B) 0x5A84469: QWindowPrivate::create(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Gui.so.5.7.1)
          | | | |                         ->01.26% (80,476B) 0x52C733B: QWidgetPrivate::create_sys(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | |                           ->01.26% (80,476B) 0x52C6B07: QWidget::create(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | |                             ->01.26% (80,476B) 0x52D3330: QWidget::setVisible(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | |                               ->01.26% (80,476B) 0x403422: main (main.cpp:11)
          | | | |                                 
          | | | ->00.24% (15,164B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | 
          | | ->00.93% (59,416B) in 5+ places, all below ms_print's threshold (01.00%)
          | | 
          | ->00.31% (20,070B) in 8+ places, all below ms_print's threshold (01.00%)
          | 
          ->04.05% (259,424B) 0x670DD13: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->04.05% (259,424B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | ->04.05% (259,424B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | |   ->04.05% (259,424B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |     ->04.05% (259,424B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |       ->04.05% (259,424B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |         ->04.05% (259,424B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |           ->04.05% (259,424B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |             ->04.05% (259,424B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |               ->04.05% (259,424B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |                 ->04.05% (259,424B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                   ->04.05% (259,424B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                     ->04.05% (259,424B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                       ->04.05% (259,424B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                         ->04.05% (259,424B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | |                           ->04.05% (259,424B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | |                             
          | ->00.00% (0B) in 1+ places, all below ms_print's threshold (01.00%)
          | 
          ->01.04% (66,687B) 0x16C26D3E: ???
          | ->01.04% (66,687B) 0x16C26D96: ???
          |   ->01.04% (66,687B) in 16+ places, all below ms_print's threshold (01.00%)
          |   
          ->12.18% (779,625B) in 321+ places, all below ms_print's threshold (01.00%)
          
          
          --------------------------------------------------------------------------------
            n       time(ms)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
          --------------------------------------------------------------------------------
           66    436,872,810       15,726,648       13,091,029     2,635,619            0
          83.24% (13,091,029B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
          ->37.86% (5,954,647B) 0x65203EE: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->20.01% (3,147,520B) 0x66EC6B0: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | ->20.01% (3,146,496B) 0x66EC8B3: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | ->20.01% (3,146,496B) 0x66E818C: QCoreApplication::postEvent(QObject*, QEvent*, int) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | ->20.01% (3,146,368B) 0x670DCD4: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | ->20.00% (3,145,728B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | | | | | ->20.00% (3,145,728B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | | | | |   ->20.00% (3,145,728B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |     ->20.00% (3,145,728B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |       ->20.00% (3,145,728B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |         ->20.00% (3,145,728B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |           ->20.00% (3,145,728B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |             ->20.00% (3,145,728B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |               ->20.00% (3,145,728B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | | | | | |                 ->20.00% (3,145,728B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                   ->20.00% (3,145,728B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                     ->20.00% (3,145,728B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                       ->20.00% (3,145,728B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | | | | | |                         ->20.00% (3,145,728B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | | | | | |                           ->20.00% (3,145,728B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | | | | | |                             
          | | | | | ->00.00% (640B) in 2+ places, all below ms_print's threshold (01.00%)
          | | | | | 
          | | | | ->00.00% (128B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | | 
          | | | ->00.00% (0B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | 
          | | ->00.01% (1,024B) in 1+ places, all below ms_print's threshold (01.00%)
          ->24.45% (3,844,632B) 0x670DD13: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->24.45% (3,844,544B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | ->24.45% (3,844,544B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | |   ->24.45% (3,844,544B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |     ->24.45% (3,844,544B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |       ->24.45% (3,844,544B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |         ->24.45% (3,844,544B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |           ->24.45% (3,844,544B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |             ->24.45% (3,844,544B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |               ->24.45% (3,844,544B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |                 ->24.45% (3,844,544B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                   ->24.45% (3,844,544B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                     ->24.45% (3,844,544B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                       ->24.45% (3,844,544B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                         ->24.45% (3,844,544B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | |                           ->24.45% (3,844,544B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | |                             
          | ->00.00% (88B) in 1+ places, all below ms_print's threshold (01.00%)
          ->02.94% (461,962B) 0x19087650: ??? (in /usr/lib64/dri/i965_dri.so)
          | ->02.81% (441,892B) 0x190876AC: ??? (in /usr/lib64/dri/i965_dri.so)
          | | ->02.43% (382,476B) 0x18FF5910: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | ->02.34% (367,312B) 0x19118A05: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | ->01.82% (286,836B) 0x19118E6C: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | | ->01.82% (286,836B) 0x190CA81E: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | |   ->01.82% (286,836B) 0x19088EEE: ??? (in /usr/lib64/dri/i965_dri.so)
          | | | | |     ->01.82% (286,836B) 0x6BDAD9F: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | | |       ->01.82% (286,836B) 0x6BB02D7: ??? (in /usr/lib64/libGL.so.1.2.0)
          | | | | |         ->01.82% (286,836B) 0x6BAC4C5: glXGetFBConfigs (in /usr/lib64/libGL.so.1.2.0)
          | | | | |           ->01.82% (286,836B) 0x6BAD064: glXChooseFBConfig (in /usr/lib64/libGL.so.1.2.0)
          | | | | |             ->01.82% (286,836B) 0x187B3525: ???
          | | | | |               ->01.82% (286,836B) 0x187B384B: ???
          | | | | |                 ->01.82% (286,836B) 0x187B0157: ???
          | | | | |                   ->01.82% (286,836B) 0x164D5CFF: ???
          | | | | |                     ->01.82% (286,836B) 0x164C0F7E: ???
          | | | | |                       ->01.82% (286,836B) 0x5A84469: QWindowPrivate::create(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Gui.so.5.7.1)
          | | | | |                         ->01.82% (286,836B) 0x52C733B: QWidgetPrivate::create_sys(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                           ->01.82% (286,836B) 0x52C6B07: QWidget::create(unsigned long long, bool, bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                             ->01.82% (286,836B) 0x52D3330: QWidget::setVisible(bool) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Widgets.so.5.7.1)
          | | | | |                               ->01.82% (286,836B) 0x403422: main (main.cpp:11)
          | | | | |                                 
          | | | | ->00.51% (80,476B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | | 
          | | | ->00.10% (15,164B) in 1+ places, all below ms_print's threshold (01.00%)
          | | | 
          | | ->00.38% (59,416B) in 5+ places, all below ms_print's threshold (01.00%)
          | | 
          | ->00.13% (20,070B) in 8+ places, all below ms_print's threshold (01.00%)
          | 
          ->02.22% (349,512B) 0x670DABF: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->02.22% (349,504B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | ->02.22% (349,504B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | |   ->02.22% (349,504B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |     ->02.22% (349,504B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |       ->02.22% (349,504B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |         ->02.22% (349,504B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |           ->02.22% (349,504B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |             ->02.22% (349,504B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |               ->02.22% (349,504B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |                 ->02.22% (349,504B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                   ->02.22% (349,504B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                     ->02.22% (349,504B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                       ->02.22% (349,504B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                         ->02.22% (349,504B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | |                           ->02.22% (349,504B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | |                             
          | ->00.00% (8B) in 1+ places, all below ms_print's threshold (01.00%)
          | 
          ->01.11% (174,756B) 0x670E050: QMetaObject::activate(QObject*, int, int, void**) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | ->01.11% (174,752B) 0x61B180C: QNetworkConfigurationManagerPrivate::updateConfigurations() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | | ->01.11% (174,752B) 0x62245AB: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Network.so.5.7.1)
          | |   ->01.11% (174,752B) 0x670ECA8: QObject::event(QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |     ->01.11% (174,752B) 0x66E6099: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |       ->01.11% (174,752B) 0x66E8AE9: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |         ->01.11% (174,752B) 0x6733101: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |           ->01.11% (174,752B) 0xA8E7998: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |             ->01.11% (174,752B) 0xA8E7CE6: ??? (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |               ->01.11% (174,752B) 0xA8E7D9A: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.4000.0)
          | |                 ->01.11% (174,752B) 0x67334F5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                   ->01.11% (174,752B) 0x66E4398: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                     ->01.11% (174,752B) 0x651AE4A: QThread::exec() (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                       ->01.11% (174,752B) 0x651F537: ??? (in /opt/Qt/5.7.1/5.7/gcc_64/lib/libQt5Core.so.5.7.1)
          | |                         ->01.11% (174,752B) 0x6E04DC3: start_thread (in /usr/lib64/libpthread-2.17.so)
          | |                           ->01.11% (174,752B) 0x792F21B: clone (in /usr/lib64/libc-2.17.so)
          | |                             
          | ->00.00% (4B) in 1+ places, all below ms_print's threshold (01.00%)
          | 
          ->05.16% (811,072B) in 233+ places, all below ms_print's threshold (01.00%)
          
          --------------------------------------------------------------------------------
            n       time(ms)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
          --------------------------------------------------------------------------------
           67    441,818,784       14,753,056       12,091,797     2,661,259            0
          
          
          
          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            Are you sure it comes from QSoundEffect ?
            And not from any of the loaded Qt SO files or linux So files?

            Does a default Qt project produce such build op?

            R 1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              Since you provided a runnable sample, i tried in on win 10, vs compiler2015, Qt5.9

              I could not detect any increase in memory.
              Even tried a more fine grained reporter but the memory seems to stay
              steady.

              alt text

              Ill let it run for some hours more and see.

              Ready to run project for other that might have time for a test
              https://www.dropbox.com/s/4krk1rpv0virff9/QSoundEffectTest.zip?dl=0

              R Offline
              R Offline
              robcreamer
              wrote on last edited by
              #6

              @mrjj I believe the private counter is the amount of memory that the operating system has allocated to the program, which may differ from the amount that the program has requested (the OS may be allocating extra memory to improve the performance of future requests). If the allocated memory is great enough, it may take a long time to show cumulative requests sufficient to increase that value.

              mrjjM 1 Reply Last reply
              0
              • R robcreamer

                @mrjj I believe the private counter is the amount of memory that the operating system has allocated to the program, which may differ from the amount that the program has requested (the OS may be allocating extra memory to improve the performance of future requests). If the allocated memory is great enough, it may take a long time to show cumulative requests sufficient to increase that value.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @robcreamer
                Ok. i will try to leaving it running in a linux box for days and see if i can reproduce it.

                R 1 Reply Last reply
                0
                • mrjjM mrjj

                  Hi
                  Are you sure it comes from QSoundEffect ?
                  And not from any of the loaded Qt SO files or linux So files?

                  Does a default Qt project produce such build op?

                  R Offline
                  R Offline
                  robcreamer
                  wrote on last edited by
                  #8

                  @mrjj I am not sure. When I removed the QSoundEffect allocations from my real project, the memory allocation quickly reached a steady state. So I isolated the code to a sample project and I was able to reproduce it. In the report, the use of QNetworkConfigurationManager may be of interest. Without QSoundEffect, my main program does not use QtNetwork.

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @robcreamer
                    Ok. i will try to leaving it running in a linux box for days and see if i can reproduce it.

                    R Offline
                    R Offline
                    robcreamer
                    wrote on last edited by
                    #9

                    @mrjj Were you able to reproduce the problem on your machines?

                    mrjjM 1 Reply Last reply
                    0
                    • R robcreamer

                      @mrjj Were you able to reproduce the problem on your machines?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @robcreamer
                      Yes to some degree. it would raise during 2 days ( very little though) , but on day 3 it did not change for 13 hours at all. and i had to reboot to do other stuff.
                      On linux mint. Qt 5.9

                      1 Reply Last reply
                      0
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #11

                        Hi @robcreamer, this is outside my expertise, but I suggest you subscribe to the Interest mailing list (http://lists.qt-project.org/mailman/listinfo/interest ) and post your sample code + 122.7-hour log there. I'm sure one of the Qt engineers on the list can tell you what's happening.

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved