--- a/webengine/osswebengine/JavaScriptCore/kjs/interpreter.cpp Fri May 08 08:25:06 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/kjs/interpreter.cpp Fri Jul 03 15:54:40 2009 +0100
@@ -80,12 +80,26 @@
Interpreter* Interpreter::s_hook = 0;
typedef HashMap<JSObject*, Interpreter*> InterpreterMap;
+static InterpreterMap* map = 0;
static inline InterpreterMap &interpreterMap()
{
- static InterpreterMap* map = new InterpreterMap;
+ if(!map )
+ map = new InterpreterMap;
return* map;
}
+struct cleanupInterpreterMap {
+ ~cleanupInterpreterMap() {
+ if(map)
+ {
+ map->clear();
+ delete map;
+ map = NULL;
+ }
+ }
+};
+static cleanupInterpreterMap deleteInterpreterMap;
+
EXPORT
Interpreter::Interpreter(JSObject* globalObject)
: m_globalExec(this, 0)
@@ -145,7 +159,11 @@
// This was the last interpreter
s_hook = 0;
}
+
interpreterMap().remove(m_globalObject);
+
+ // It's likely that destroying the interpreter has created a lot of garbage.
+ Collector::collect();
}
EXPORT