diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
index f2fc6a8a9313c405fda7efd507329d73005297a6..2d39fc7e77fa73b1767c51d755b20987f9bb1043 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -243,15 +243,13 @@ void QmlProfilerFileReader::loadQzt(QIODevice *device)
         updateProgress(device);
     }
 
-    const int eventBufferLength = 1024;
-    QVector<QmlEvent> eventBuffer(eventBufferLength);
-    int eventBufferIndex = 0;
+    QVector<QmlEvent> eventBuffer;
     while (!stream.atEnd() && !isCanceled()) {
         stream >> data;
         buffer.setData(qUncompress(data));
         buffer.open(QIODevice::ReadOnly);
         while (!buffer.atEnd() && !isCanceled()) {
-            QmlEvent &event = eventBuffer[eventBufferIndex];
+            QmlEvent event;
             bufferStream >> event;
             if (bufferStream.status() == QDataStream::Ok) {
                 if (event.typeIndex() >= m_eventTypes.length()) {
@@ -267,11 +265,10 @@ void QmlProfilerFileReader::loadQzt(QIODevice *device)
             } else {
                 Q_UNREACHABLE();
             }
-            if (++eventBufferIndex == eventBufferLength) {
-                emit qmlEventsLoaded(eventBuffer);
-                eventBufferIndex = 0;
-            }
+            eventBuffer.append(event);
         }
+        emit qmlEventsLoaded(eventBuffer);
+        eventBuffer.clear();
         buffer.close();
         updateProgress(device);
     }
@@ -279,7 +276,6 @@ void QmlProfilerFileReader::loadQzt(QIODevice *device)
     if (isCanceled()) {
         emit canceled();
     } else {
-        eventBuffer.resize(eventBufferIndex);
         emit qmlEventsLoaded(eventBuffer);
         emit success();
     }