Thanks for getting interested about this.

I am not seeing any difference with this one:

Rectangle {
    width: 360
    height: 640

    Rectangle {
        anchors.fill: parent
        property int i: 0
        MouseArea {
            anchors.fill: parent
            onPressed : {
                    parent.i = mouse.x
            }
            onPositionChanged:{
                    parent.i = mouse.x
            }
        }
    }
}

- Mikko
________________________________
From: Kennedy Aaron (Nokia-MS-Qt/Brisbane)
Sent: 29.12.2010 11:17
To: Kiilholma Mikko (Nokia-MS/Tampere)
Cc: Kiilholma Mikko (Nokia-MS/Tampere); [email protected]
Subject: Re: [Qt-qml] Some memory allocated for every mouse click.

Hi,

As strange as this may sound, can you try inserting another root Rectangle (so 
that the MouseArea's parent is not the root element) and see if you get the 
same results?

Cheers,

Aaron

On 29/12/2010, at 6:38 PM, "ext 
[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>> wrote:

It seems that this is how JavaScript and garbage collection works. With this 
example the memory usage just seems to be quite excessive.

________________________________
From: 
[email protected]<mailto:[email protected]>
 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of ext <mailto:[email protected]> 
[email protected]<mailto:[email protected]>
Sent: 28.12.2010 03:28
To: <mailto:[email protected]> [email protected]<mailto:[email protected]>
Subject: [Qt-qml] Some memory allocated for every mouse click.

Hi,

I would like to know what's the reasoning behind this: The following code 
causes allocation of 160 bytes every time the window is clicked (the GlowCode 
call stacks of the allocations below).
I first thought that this is a leak but soon realized that the first 
allocations are getting deleted later when the window has been clicked for 
hundreds of times.
Dragging around the empty window causes allocations and deallocations to occur 
in very high rate.
(My environment is Windows XP, Visual Studio, GlowCode, Qt4.7.1.)

Is this effective memory handling?

import Qt 4.7
import QtQuick 1.0

Rectangle {
    width: 360
    height: 640
    property int i: 0
    MouseArea {
                anchors.fill: parent
                onPressed : {
                        parent.i = mouse.x
                }
                onPositionChanged:{
                        parent.i = mouse.x
                }
        }
}


StackTrace Content
  MSVCR90D!malloc_base+254 bytes 0x4D103E
  MSVCR90D!malloc_dbg+774 bytes 0x4DFD76
  MSVCR90D!malloc_dbg+191 bytes 0x4DFB2F
  MSVCR90D!malloc_dbg+108 bytes 0x4DFADC
  MSVCR90D!malloc+27 bytes 0x4EB25B
  MSVCR90D!operator new+17 bytes 0x4CD691
  QtScriptd4!QScriptDeclarativeClass::newObject file 
C:\Qt\4.7.1\src\script\bridge\qscriptdeclarativeclass.cpp line 202+7 bytes 
0x101E4D81
  QtDeclaratived4!QDeclarativeObjectScriptClass::newQObject file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 120+109 
bytes 0x66199FD2
  QtDeclaratived4!QDeclarativeObjectScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 258+35 
bytes 0x6619AA67
  QtDeclaratived4!QDeclarativeContextScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativecontextscriptclass.cpp line 273+29 
bytes 0x660A1D14
  QtScriptd4!QTJSC::JSObject::getPropertySlot file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsobject.h line 
391+20 bytes 0x100413AC
  QtScriptd4!cti_op_resolve_skip file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitstubs.cpp line 
2298+20 bytes 0x100C2CE8
  QtScriptd4!QTWTF::RefPtr<QTJSC::UStringImpl>::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\wtf\refptr.h line 117+0 
bytes 0x100375B0
  QtScriptd4!QTJSC::Register::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\register.h 
line 118+15 bytes 0x10092C26
  QtScriptd4!QTJSC::ExecState::setCalleeArguments file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\callframe.h 
line 113+22 bytes 0x10094436
  QtScriptd4!QTJSC::JITCode::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitcode.h line 79+36 
bytes 0x100945BB
  QtScriptd4!QTJSC::Interpreter::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\interpreter.cpp
 line 716+49 bytes 0x1008630D
  QtScriptd4!QTJSC::JSFunction::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsfunction.cpp 
line 122+78 bytes 0x1010BF05
  QtScriptd4!QTJSC::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\calldata.cpp 
line 62+43 bytes 0x100E5E36
  QtScriptd4!QScriptValue::call file 
C:\Qt\4.7.1\src\script\api\qscriptvalue.cpp line 1605+59 bytes 0x101C3739
  QtDeclaratived4!QDeclarativeQtScriptExpression::eval file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 479+67 bytes 
0x660DE901
  QtDeclaratived4!QDeclarativeQtScriptExpression::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 434+20 bytes 
0x660DE6E4
  QtDeclaratived4!QDeclarativeExpressionPrivate::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 614+23 bytes 
0x660DF149
  QtDeclaratived4!QDeclarativeExpressionPrivate::value file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 628+31 bytes 
0x660DF227
  QtDeclaratived4!QDeclarativeBoundSignal::qt_metacall file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeboundsignal.cpp line 177+35 bytes 
0x6604CCAF
  QtCored4!QMetaObject::activate file 
c:\qt\4.7.1\src\corelib\kernel\qobject.cpp line 3465+39 bytes 0x671518CC
  QtDeclaratived4!QDeclarativeMouseArea::pressed file 
c:\qt\4.7.1\src\declarative\tmp\moc\debug_shared\moc_qdeclarativemousearea_p.cpp
 line 429+21 bytes 0x662B135B
  QtDeclaratived4!QDeclarativeMouseArea::setPressed file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 845+0 
bytes 0x661985F9
  QtDeclaratived4!QDeclarativeMouseArea::mousePressEvent file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 462+13 
bytes 0x66196D5E
  gc6prof!0xb22151 0xB22151
  gc6prof!0xb21f1d 0xB21F1D
  gc6prof!MessageOut::OutputLastError+45268 bytes 0xB3C5C4

  StackTrace Content
  MSVCR90D!malloc_base+254 bytes 0x4D103E
  MSVCR90D!malloc_dbg+774 bytes 0x4DFD76
  MSVCR90D!malloc_dbg+191 bytes 0x4DFB2F
  MSVCR90D!malloc_dbg+108 bytes 0x4DFADC
  MSVCR90D!malloc+27 bytes 0x4EB25B
  MSVCR90D!operator new+17 bytes 0x4CD691
  QtDeclaratived4!QDeclarativeObjectScriptClass::newQObject file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 120+33 
bytes 0x66199F86
  QtDeclaratived4!QDeclarativeObjectScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 258+35 
bytes 0x6619AA67
  QtDeclaratived4!QDeclarativeContextScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativecontextscriptclass.cpp line 273+29 
bytes 0x660A1D14
  QtScriptd4!QTJSC::JSObject::getPropertySlot file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsobject.h line 
391+20 bytes 0x100413AC
  QtScriptd4!cti_op_resolve_skip file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitstubs.cpp line 
2298+20 bytes 0x100C2CE8
  QtScriptd4!QTWTF::RefPtr<QTJSC::UStringImpl>::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\wtf\refptr.h line 117+0 
bytes 0x100375B0
  QtScriptd4!QTJSC::Register::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\register.h 
line 118+15 bytes 0x10092C26
  QtScriptd4!QTJSC::ExecState::setCalleeArguments file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\callframe.h 
line 113+22 bytes 0x10094436
  QtScriptd4!QTJSC::JITCode::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitcode.h line 79+36 
bytes 0x100945BB
  QtScriptd4!QTJSC::Interpreter::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\interpreter.cpp
 line 716+49 bytes 0x1008630D
  QtScriptd4!QTJSC::JSFunction::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsfunction.cpp 
line 122+78 bytes 0x1010BF05
  QtScriptd4!QTJSC::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\calldata.cpp 
line 62+43 bytes 0x100E5E36
  QtScriptd4!QScriptValue::call file 
C:\Qt\4.7.1\src\script\api\qscriptvalue.cpp line 1605+59 bytes 0x101C3739
  QtDeclaratived4!QDeclarativeQtScriptExpression::eval file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 479+67 bytes 
0x660DE901
  QtDeclaratived4!QDeclarativeQtScriptExpression::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 434+20 bytes 
0x660DE6E4
  QtDeclaratived4!QDeclarativeExpressionPrivate::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 614+23 bytes 
0x660DF149
  QtDeclaratived4!QDeclarativeExpressionPrivate::value file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 628+31 bytes 
0x660DF227
  QtDeclaratived4!QDeclarativeBoundSignal::qt_metacall file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeboundsignal.cpp line 177+35 bytes 
0x6604CCAF
  QtCored4!QMetaObject::activate file 
c:\qt\4.7.1\src\corelib\kernel\qobject.cpp line 3465+39 bytes 0x671518CC
  QtDeclaratived4!QDeclarativeMouseArea::pressed file 
c:\qt\4.7.1\src\declarative\tmp\moc\debug_shared\moc_qdeclarativemousearea_p.cpp
 line 429+21 bytes 0x662B135B
  QtDeclaratived4!QDeclarativeMouseArea::setPressed file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 845+0 
bytes 0x661985F9
  QtDeclaratived4!QDeclarativeMouseArea::mousePressEvent file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 462+13 
bytes 0x66196D5E
  gc6prof!0xb22151 0xB22151
  gc6prof!0xb21f1d 0xB21F1D
  gc6prof!MessageOut::OutputLastError+45268 bytes 0xB3C5C4
  gc6prof!MessageOut::OutputLastError+45311 bytes 0xB3C5EF


StackTrace Content
  MSVCR90D!malloc_base+254 bytes 0x4D103E
  MSVCR90D!malloc_dbg+774 bytes 0x4DFD76
  MSVCR90D!malloc_dbg+191 bytes 0x4DFB2F
  MSVCR90D!malloc_dbg+108 bytes 0x4DFADC
  MSVCR90D!malloc+27 bytes 0x4EB25B
  MSVCR90D!operator new+17 bytes 0x4CD691
  QtScriptd4!QScriptObject::setDelegate file 
C:\Qt\4.7.1\src\script\bridge\qscriptobject_p.h line 168+7 bytes 0x101AFB38
  QtScriptd4!QScriptDeclarativeClass::newObject file 
C:\Qt\4.7.1\src\script\bridge\qscriptdeclarativeclass.cpp line 203+0 bytes 
0x101E4DC3
  QtDeclaratived4!QDeclarativeObjectScriptClass::newQObject file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 120+109 
bytes 0x66199FD2
  QtDeclaratived4!QDeclarativeObjectScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeobjectscriptclass.cpp line 258+35 
bytes 0x6619AA67
  QtDeclaratived4!QDeclarativeContextScriptClass::property file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativecontextscriptclass.cpp line 273+29 
bytes 0x660A1D14
  QtScriptd4!QTJSC::JSObject::getPropertySlot file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsobject.h line 
391+20 bytes 0x100413AC
  QtScriptd4!cti_op_resolve_skip file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitstubs.cpp line 
2298+20 bytes 0x100C2CE8
  QtScriptd4!QTWTF::RefPtr<QTJSC::UStringImpl>::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\wtf\refptr.h line 117+0 
bytes 0x100375B0
  QtScriptd4!QTJSC::Register::operator= file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\register.h 
line 118+15 bytes 0x10092C26
  QtScriptd4!QTJSC::ExecState::setCalleeArguments file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\callframe.h 
line 113+22 bytes 0x10094436
  QtScriptd4!QTJSC::JITCode::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\jit\jitcode.h line 79+36 
bytes 0x100945BB
  QtScriptd4!QTJSC::Interpreter::execute file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\interpreter\interpreter.cpp
 line 716+49 bytes 0x1008630D
  QtScriptd4!QTJSC::JSFunction::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\jsfunction.cpp 
line 122+78 bytes 0x1010BF05
  QtScriptd4!QTJSC::call file 
C:\Qt\4.7.1\src\3rdparty\javascriptcore\javascriptcore\runtime\calldata.cpp 
line 62+43 bytes 0x100E5E36
  QtScriptd4!QScriptValue::call file 
C:\Qt\4.7.1\src\script\api\qscriptvalue.cpp line 1605+59 bytes 0x101C3739
  QtDeclaratived4!QDeclarativeQtScriptExpression::eval file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 479+67 bytes 
0x660DE901
  QtDeclaratived4!QDeclarativeQtScriptExpression::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 434+20 bytes 
0x660DE6E4
  QtDeclaratived4!QDeclarativeExpressionPrivate::scriptValue file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 614+23 bytes 
0x660DF149
  QtDeclaratived4!QDeclarativeExpressionPrivate::value file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeexpression.cpp line 628+31 bytes 
0x660DF227
  QtDeclaratived4!QDeclarativeBoundSignal::qt_metacall file 
c:\qt\4.7.1\src\declarative\qml\qdeclarativeboundsignal.cpp line 177+35 bytes 
0x6604CCAF
  QtCored4!QMetaObject::activate file 
c:\qt\4.7.1\src\corelib\kernel\qobject.cpp line 3465+39 bytes 0x671518CC
  QtDeclaratived4!QDeclarativeMouseArea::pressed file 
c:\qt\4.7.1\src\declarative\tmp\moc\debug_shared\moc_qdeclarativemousearea_p.cpp
 line 429+21 bytes 0x662B135B
  QtDeclaratived4!QDeclarativeMouseArea::setPressed file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 845+0 
bytes 0x661985F9
  QtDeclaratived4!QDeclarativeMouseArea::mousePressEvent file 
c:\qt\4.7.1\src\declarative\graphicsitems\qdeclarativemousearea.cpp line 462+13 
bytes 0x66196D5E
  gc6prof!0xb22151 0xB22151
  gc6prof!0xb21f1d 0xB21F1D




_______________________________________________
Qt-qml mailing list
[email protected]<mailto:[email protected]>
http://lists.qt.nokia.com/mailman/listinfo/qt-qml
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to