Closed Bug 150015 Opened 22 years ago Closed 17 years ago

trace-malloc slows down builds even when not used

Categories

(Core :: XPCOM, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: dbaron, Assigned: dbaron)

Details

Attachments

(1 file, 2 obsolete files)

trace-malloc slows down builds even when it's not used (no --trace-malloc
argument on the command line), by roughly a factor of 4, even though, as far as
I know, there's no way to get useful output from it (I might be wrong here,
though).  suppress_tracing is never even set to non-zero.  I'm going to attach a
patch that I think should fix this problem (and which makes my debug build
usable again).
Attached patch patch (obsolete) — Splinter Review
Are there any ways of using trace-malloc that this would break?
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.1beta
Yes, this will break scripted uses (see dom/src/base/nsJSEnvironment.cpp, look
for TraceMalloc).

/be
I could never get those to work without using --trace-malloc on the command-line
anyway.  I thought it had something to do with an initial buffer size.  Maybe my
memory is wrong, though...
Target Milestone: mozilla1.1beta → mozilla1.2alpha
Target Milestone: mozilla1.2alpha → Future
Attached patch patch (obsolete) — Splinter Review
Pretty much the same thing, but fixes a bogus |return;|.  (For reference.  No
intent to check in.)
Attachment #86831 - Attachment is obsolete: true
QA Contact: scc → xpcom
Attached patch patchSplinter Review
Here's the patch again (rewritten from the last one, since it uses different variable names).
Attachment #103407 - Attachment is obsolete: true
Attachment #274855 - Flags: review?(brendan)
(Except I'm not sure how the enable/disable functions ever worked dynamically, or what they'd be used for.)
Though, actually, this patch fixes Enable/Disable by setting tracing_enabled, so maybe it's ok (or as ok as it's always been).
Comment on attachment 274855 [details] [diff] [review]
patch

>+    if (!PR_Initialized() || !tracing_enabled) {

Transpose these || terms for faster results, right?

With the same change elsewhere, r=me.

/be
Attachment #274855 - Flags: review?(brendan) → review+
Comment on attachment 274855 [details] [diff] [review]
patch

This is a performance fix for the trace-malloc debugging tool that makes it so that trace-malloc doesn't degrade performance significantly when it is compiled in but not used.  This will make it easier for other developers to build trace-malloc and debug leaks without suffering the degradation.  No risk to releases, which don't ship this code.
Attachment #274855 - Flags: approval1.9?
Comment on attachment 274855 [details] [diff] [review]
patch

a=bzbarsky
Attachment #274855 - Flags: approval1.9? → approval1.9+
Fix checked in to trunk, 2007-08-10 14:24.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: Future → mozilla1.9 M8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: