diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-03-25 13:45:51 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-03-25 14:05:13 (GMT) |
commit | 2fdfb3e0285ac535b63548d208da6dcae71105cc (patch) | |
tree | 4072a9c4cbc3ce49af779143f44776bdaf0c4f59 /demos/arthurplugin | |
parent | 062af5a146e4875ace293823452347a572eda14f (diff) | |
download | Qt-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 'demos/arthurplugin')
0 files changed, 0 insertions, 0 deletions