summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptvalue.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-03-25 13:45:51 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-03-25 14:05:13 (GMT)
commit2fdfb3e0285ac535b63548d208da6dcae71105cc (patch)
tree4072a9c4cbc3ce49af779143f44776bdaf0c4f59 /src/script/api/qscriptvalue.cpp
parent062af5a146e4875ace293823452347a572eda14f (diff)
downloadQt-2fdfb3e0285ac535b63548d208da6dcae71105cc.zip
Qt-2fdfb3e0285ac535b63548d208da6dcae71105cc.tar.gz
Qt-2fdfb3e0285ac535b63548d208da6dcae71105cc.tar.bz2
QtScript: Add API for reporting additional memory costs
QScriptEngine::reportAdditionalMemoryCost(int). This function provides the ability to give a hint to the engine that it should perhaps trigger garbage collection sooner rather than later. For example, if you've implemented a JS ByteArray class that wraps a QByteArray, and a user constructs a few hundred temporary ByteArray objects of large sizes, failure to report the additional memory cost may cause the application's memory consumption to grow and grow (because the script engine thinks they are "cheap" objects, the GC won't kick in). Reporting the correct size can be difficult (or impossible) in some cases. For example, it's difficult to predict the total amount of system memory & resources consumed by a QImage. But even reporting a heuristic / approximate cost can be better than reporting no cost. Task-number: QTBUG-6238 Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r--src/script/api/qscriptvalue.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 3fe0e7d..4cd84a4 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1970,6 +1970,8 @@ QScriptValue QScriptValue::data() const
this function to set object-specific data that won't be directly
accessible to scripts, but may be retrieved in C++ using the data()
function.
+
+ \sa QScriptEngine::reportAdditionalMemoryCost()
*/
void QScriptValue::setData(const QScriptValue &data)
{