Bug 487968 - TM: shutdown leak of rt->builtinFunctions (r=jorendorff).
authorBrendan Eich <brendan@mozilla.org>
Mon, 13 Apr 2009 14:22:01 -0700
changeset 24911 6fd196ae4f20e08fac113d3de838518c1fe0c69f
parent 24910 2f83aa29331b24bf661a07e2bfd42c377fb65924
child 24912 254332d567d89b688728d0a6f3cba550f361443b
push id1267
push userrsayre@mozilla.com
push dateSun, 19 Apr 2009 02:47:24 +0000
reviewersjorendorff
bugs487968
milestone1.9.1b4pre
Bug 487968 - TM: shutdown leak of rt->builtinFunctions (r=jorendorff).
js/src/jscntxt.cpp
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -666,16 +666,19 @@ js_DestroyContext(JSContext *cx, JSDestr
          * request to end.  We'll let it run below, just before we do the truly
          * final GC and then free atom state.
          */
         while (cx->requestDepth != 0)
             JS_EndRequest(cx);
 #endif
 
         if (last) {
+            /* Clear builtin functions, which are recreated on demand. */
+            memset(rt->builtinFunctions, 0, sizeof rt->builtinFunctions);
+
             js_GC(cx, GC_LAST_CONTEXT);
             DUMP_EVAL_CACHE_METER(cx);
             DUMP_FUNCTION_METER(cx);
 
             /*
              * Free the script filename table if it exists and is empty. Do this
              * after the last GC to avoid finalizers tripping on free memory.
              */