Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8400

qtscript memory leak

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.3
    • 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2
    • Qt Script
    • None
    • linux, gcc-4.4.1
    • bab4c3056c11ba3607acce3314ecfe172d00cf96

    Description

      The following example leaks the memory of the argument passed to the script function call.
      It seems like the argument is never marked for garbage collection.
      Am I using the API in the right way?

      Thanks.

      #include <QCoreApplication>
      #include <QScriptValue>
      #include <QScriptEngine>
      #include <QDebug>

      class Test : QObject
      {
      Q_OBJECT
      public:
      Test()
      {
      functionCode = "function f(a)

      { print(a); return false; }

      ";
      engine.evaluate(functionCode);
      v = engine.globalObject().property("f");
      startTimer(0);
      };
      void timerEvent(QTimerEvent* t)

      { QScriptValueList list; list << QScriptValue(23); v.call(QScriptValue(), list ); engine.collectGarbage(); }

      QScriptValue v;
      QString functionCode;
      QScriptEngine engine;
      };

      int main(int argc, char** argv)
      {
      QCoreApplication app(argc, argv);
      Test t;
      return app.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kenthans Kent Hansen (Inactive)
            zanettea arrigo zanette
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes