diff options
| author | Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> | 2023-12-26 14:15:45 +0900 |
|---|---|---|
| committer | Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> | 2024-01-11 08:42:18 +0900 |
| commit | b12d94bbed4a0985c0907020e31f3ea9c3b09cc2 (patch) | |
| tree | 54b29e9ad5d11c22a36cfeee8947169d9a635812 | |
| parent | 2dbae968e7a15aca2ff5c8795e2a6dcb2e0a5744 (diff) | |
Add doc for gc()
Change-Id: I920acf76846bece462b518239fc4c068a0fad8c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| -rw-r--r-- | src/qml/doc/src/javascript/memory.qdoc | 2 | ||||
| -rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 6 | ||||
| -rw-r--r-- | src/qml/qml/qqmlbuiltinfunctions.cpp | 8 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/qml/doc/src/javascript/memory.qdoc b/src/qml/doc/src/javascript/memory.qdoc index c7dcc00d98..54f48f48df 100644 --- a/src/qml/doc/src/javascript/memory.qdoc +++ b/src/qml/doc/src/javascript/memory.qdoc @@ -163,7 +163,7 @@ is completely empty, it is decommitted, but the address space is retained (see \l{Basic Principles} above). If the memory usage grows again, the same address space is re-used. -The garbage collector is triggered either manually by calling the gc() function +The garbage collector is triggered either manually by calling the \l [QML] {Qt::}{gc()} function or by a heuristic that takes the following aspects into account: \list diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index 8c40d95961..42a279ca25 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -389,7 +389,11 @@ QJSEngine::~QJSEngine() when the QJSEngine decides that it's wise to do so (i.e. when a certain number of new objects have been created). However, you can call this function to explicitly request that garbage collection should be performed as soon as possible. -*/ + + + \sa {Garbage Collection} + \sa {Qt::}{gc()} + */ void QJSEngine::collectGarbage() { m_v4Engine->memoryManager->runGC(); diff --git a/src/qml/qml/qqmlbuiltinfunctions.cpp b/src/qml/qml/qqmlbuiltinfunctions.cpp index 855620922f..61370b401d 100644 --- a/src/qml/qml/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/qqmlbuiltinfunctions.cpp @@ -2356,7 +2356,15 @@ ReturnedValue GlobalExtensions::method_qsTrIdNoOp(const FunctionObject *, const } #endif // translation +/*! + \qmlmethod void Qt::gc() + + Runs the garbage collector. + This is equivalent to calling QJSEngine::collectGarbage(). + + \sa {Garbage Collection} +*/ ReturnedValue GlobalExtensions::method_gc(const FunctionObject *b, const Value *, const Value *, int) { auto mm = b->engine()->memoryManager; |
