Bug 789717. Use JS_InternStringN to avoid large memory usage in the profiler. r=ehsan
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 17 Sep 2012 14:22:47 -0400
changeset 114141 7096242b4edde22375d8511d2386d745a429f1ea
parent 114140 c05ca0508f221809af173218086e86731f5efe1b
child 114142 83a7ea5398a988ff151d06f65b4fc852328e30e8
push id239
push userakeybl@mozilla.com
push dateThu, 03 Jan 2013 21:54:43 +0000
treeherdermozilla-release@3a7b66445659 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs789717
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 789717. Use JS_InternStringN to avoid large memory usage in the profiler. r=ehsan We duplicate a large number of strings. This helps cut down on that.
tools/profiler/JSObjectBuilder.h
--- a/tools/profiler/JSObjectBuilder.h
+++ b/tools/profiler/JSObjectBuilder.h
@@ -51,17 +51,17 @@ class JSObjectBuilder
     mOk = JS_DefineProperty(mCx, aObject, name, STRING_TO_JSVAL(string), NULL, NULL, JSPROP_ENUMERATE);
   }
 
   void DefineProperty(JSObject *aObject, const char *name, const char *value, size_t valueLength)
   {
     if (!mOk)
       return;
 
-    JSString *string = JS_NewStringCopyN(mCx, value, valueLength);
+    JSString *string = JS_InternStringN(mCx, value, valueLength);
     if (!string) {
       mOk = JS_FALSE;
       return;
     }
 
     mOk = JS_DefineProperty(mCx, aObject, name, STRING_TO_JSVAL(string), NULL, NULL, JSPROP_ENUMERATE);
   }