From 070e0d07d821342bfbe7a409a51c4c53185c62c7 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 4 Dec 2012 11:30:26 +0100 Subject: [PATCH] Fix another memory leak. Now we should only leak objects that are VM::Values, and directly related objects like the PropertyTable. The directly related ones will disappear through destructor calls when the VM::Values are GC-ed. Change-Id: Id221ac62a22671d86bbc6ac9beea49d2bd5b330d Reviewed-by: Simon Hausmann --- qmljs_engine.cpp | 7 +++++++ qmljs_engine.h | 1 + 2 files changed, 8 insertions(+) diff --git a/qmljs_engine.cpp b/qmljs_engine.cpp index 6c5edd1..4af9005 100644 --- a/qmljs_engine.cpp +++ b/qmljs_engine.cpp @@ -187,6 +187,13 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) glo->__put__(rootContext, identifier(QStringLiteral("isFinite")), Value::fromObject(new IsFiniteFunction(rootContext))); // isFinite [15.1.2.5] } +ExecutionEngine::~ExecutionEngine() +{ + delete globalObject.asObject(); + delete rootContext; + delete stringPool; // the String pointers should get GC-ed. +} + ExecutionContext *ExecutionEngine::newContext() { return new ExecutionContext(); diff --git a/qmljs_engine.h b/qmljs_engine.h index a6f1808..d47c2d4 100644 --- a/qmljs_engine.h +++ b/qmljs_engine.h @@ -150,6 +150,7 @@ struct ExecutionEngine struct StringPool *stringPool; ExecutionEngine(EvalISelFactory *iselFactory); + ~ExecutionEngine(); ExecutionContext *newContext(); -- 2.7.4