Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Crash using a big string in QML Qt 5.5.0 (no crash in 5.4)
Forum Updated to NodeBB v4.3 + New Features

Crash using a big string in QML Qt 5.5.0 (no crash in 5.4)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 714 Views 2 Watching
  • 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.
  • F Offline
    F Offline
    frankiefrank
    wrote on last edited by
    #1

    I have some QML code which is running alright in Qt 5.4 but crashes in my later 5.5.0.

    The original code in 5.4 was a log-to-file mechanism. Instead of writing to a file at each logging call, I would append to a string, then a timer would occasionally get the string, write the string to a file (via C++/QML integration) and clear the string.

    After switching to 5.5 I noticed a crash. I eventually reduced the code to be just QML, no C++ call at all.

    property string logBuffer = ""
    
    // Place this in some rectangle you can click
    MouseArea {
    anchors.fill: parent
    onClicked: {
        console.log("Started constructing long string.");
        var str = "Something worthy of logging. For the sake of the test, I make the string a bit longer than usual, to see if there is an effect..."
        // You can increase / decrease the number of iterations
        for (var i = 0; i < 3000; i++) {
            logBuffer = logBuffer + str + i + "\n";
        }
        console.log("Long string constructed.")
    
        console.log("Clear buffer of length " + logBuffer.length);
        if (logBuffer.length > 0) {
            logBuffer = "";
        }
    }
    

    After several calls I get a crash "R6010 abort() has been called".

    I'm not even sure if this a QTBUG or I'm really misusing the QML here, mainly not sure why the newer version behaves differently.

    "Roads? Where we're going, we don't need roads."

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on last edited by
      #2

      It works ok for me with 5.4.2 and 5.5.1 on Linux. The behavior is better with 5.5.1; 5.4.2 uses over 1GB of RAM after a few clicks.

      1 Reply Last reply
      0

      • Login

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