bug 629655 - avoid influencing the malloc GC counters when dumping the heap. r=anygregor
authorIgor Bukanov <igor@mir2.org>
Fri, 28 Jan 2011 23:25:05 +0100
changeset 61688 5dbc4a422c1b0b2247ab0a13c997990d65a66e27
parent 61687 e201f9d09799634f4f7f8857e96d501f01a3f510
child 61689 824f69dad2bc82141bd6a7572cb5829306bcd424
push idunknown
push userunknown
push dateunknown
reviewersanygregor
bugs629655
milestone2.0b11pre
bug 629655 - avoid influencing the malloc GC counters when dumping the heap. r=anygregor
js/src/jsapi.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2356,18 +2356,17 @@ DumpNotify(JSTracer *trc, void *thing, u
                     (const char *)dtrc->base.debugPrintArg,
                     dtrc->base.debugPrintIndex);
         edgeName = dtrc->buffer;
     } else {
         edgeName = (const char*)dtrc->base.debugPrintArg;
     }
 
     edgeNameSize = strlen(edgeName) + 1;
-    node = (JSHeapDumpNode *)
-        cx->malloc(offsetof(JSHeapDumpNode, edgeName) + edgeNameSize);
+    node = (JSHeapDumpNode *) js_malloc(offsetof(JSHeapDumpNode, edgeName) + edgeNameSize);
     if (!node) {
         dtrc->ok = JS_FALSE;
         return;
     }
 
     node->thing = thing;
     node->kind = kind;
     node->next = NULL;
@@ -2509,17 +2508,17 @@ JS_DumpHeap(JSContext *cx, FILE *fp, voi
                 }
             }
         }
 
         /* Move to next or parents next and free the node. */
         for (;;) {
             next = node->next;
             parent = node->parent;
-            cx->free(node);
+            js_free(node);
             node = next;
             if (node)
                 break;
             if (!parent)
                 goto dump_out;
             JS_ASSERT(depth > 1);
             --depth;
             node = parent;