[Qt-qml] QML memory usage with "import QtWebKit"
warwick.allison at nokia.com
warwick.allison at nokia.com
Thu Dec 16 01:25:39 CET 2010
This is why it depends on exactly which memory you're measuring - linking in a library DOES use memory, because of the way virtual tables work in C++: just "knowing about" the type - i.e. the metaobject information, even with no instances, means the vtable must be loaded, and that of course has references to all the virtual functions (often much of the class), in addition to all signals and slots and property accessors in Qt's metaobject info.
Importing a module means making types available, and that means loading and processing. While in theory QML could delay some of that until it comes across a type it doesn't know about yet, that seems a pointless optimization.
So if the memory is mainly read-only shared code pages, there is nothing unexpected happening.
As for documentation, this is internal detail that is not really relevant to QML authors, and could in theory change at any time, so not something anyone should be relying on one way or another.
--
Warwick
I'm sharing those numbers not because I think they are somehow too high, or too low, but because I am surprised to see memory usage *grow by a significant amount* even when I'm *not instantiating* anything.
Put it another way: the fact that a single "import WebKit 1.0" line adds 10 MB of memory usage, even though I'm NOT instantiating any WebView element is an unexpected behaviour to me, and may indicate either a bug with the way QML deals with imports, or a normal but unexpected behavior that should be explained / documented.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101216/46a648db/attachment.html
More information about the Qt-qml
mailing list