diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-10-15 08:36:17 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-11-02 09:10:59 +0000 |
commit | 19b87999580d596a3b14e38f44309f16307bfe0e (patch) | |
tree | 8f1c40ca296a6414246002519af64aa124ce240c /tests | |
parent | acd0882f818bf05677e3e117dbd4975674d9578b (diff) |
Fix a crash when allocating huge memory segments
When allocating a huge item that requires it's own memory
segment, we were actually not committing enough memory from
the OS.
Fixes: QTBUG-71501
Change-Id: Ic86a648bba4d7f1eeeded78d8de0f0fc1d3a251d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 8f388fcac6..2f110ed5a5 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -359,6 +359,7 @@ private slots: void temporaryDeadZone(); void importLexicalVariables_data(); void importLexicalVariables(); + void hugeObject(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -8846,6 +8847,17 @@ void tst_qqmlecmascript::importLexicalVariables() QCOMPARE(result, QVariant(expected)); } +void tst_qqmlecmascript::hugeObject() +{ + // mainly check that this doesn't crash + QJSEngine engine; + QJSValue v = engine.evaluate(QString::fromLatin1( + "var known = {}, prefix = 'x'\n" + "for (var i = 0; i < 150000; i++) known[prefix + i] = true;" + )); + QVERIFY(!v.isError()); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |