diff options
4 files changed, 37 insertions, 3 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp index e4f2f556fc..12c36f3dd6 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp @@ -87,14 +87,17 @@ qint64 QV4ProfilerAdapter::appendMemoryEvents(qint64 until, QList<QByteArray> &m qint64 QV4ProfilerAdapter::finalizeMessages(qint64 until, QList<QByteArray> &messages, qint64 callNext, QQmlDebugPacket &d) { + qint64 memoryNext = -1; + if (callNext == -1) { m_functionLocations.clear(); m_functionCallData.clear(); m_functionCallPos = 0; + memoryNext = appendMemoryEvents(until, messages, d); + } else { + memoryNext = appendMemoryEvents(qMin(callNext, until), messages, d); } - qint64 memoryNext = appendMemoryEvents(until, messages, d); - if (memoryNext == -1) { m_memoryData.clear(); m_memoryPos = 0; diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/batchOverflow.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/batchOverflow.qml new file mode 100644 index 0000000000..dde1def947 --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/batchOverflow.qml @@ -0,0 +1,20 @@ +import QtQml 2.2 + +QtObject { + function iterate(dictionaryTable, j) { + var word = "a" + j.toString() + dictionaryTable[word] = null; + } + + Component.onCompleted: { + var dictionaryTable = {}; + for (var j = 0; j < 256; ++j) + iterate(dictionaryTable, j); + } + + property Timer timer: Timer { + interval: 1 + running: true; + onTriggered: Qt.quit(); + } +} diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 2a685ed877..0cd4b331f2 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -21,4 +21,5 @@ OTHER_FILES += \ data/javascript.qml \ data/timer.qml \ data/qstr.qml \ - data/memory.qml + data/memory.qml \ + data/batchOverflow.qml diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index eb0b0c2fe2..7fc43671c2 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -225,6 +225,7 @@ private slots: void memory(); void compile(); void multiEngine(); + void batchOverflow(); private: bool m_recordFromStart = true; @@ -826,6 +827,15 @@ void tst_QQmlProfilerService::multiEngine() QCOMPARE(spy.count(), 1); } +void tst_QQmlProfilerService::batchOverflow() +{ + // The trace client checks that the events are received in order. + QCOMPARE(connect(true, "batchOverflow.qml"), ConnectSuccess); + checkProcessTerminated(); + checkTraceReceived(); + checkJsHeap(); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" |