Closed Bug 1112968 Opened 9 years ago Closed 9 years ago

dmd.py: Add Mac- and Windows-specific functions to the --alloc-fns list

Categories

(Core :: DMD, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(2 files, 1 obsolete file)

Now that DMD works on Mac non-debug builds, I've found that it's not ignoring
some allocation functions that it should.
Attachment #8538218 - Flags: review?(continuation)
Comment on attachment 8538218 [details] [diff] [review]
dmd.py: Add Mac-specific functions to the --alloc-fns list

Review of attachment 8538218 [details] [diff] [review]:
-----------------------------------------------------------------

::: memory/replace/dmd/dmd.py
@@ +26,5 @@
>  # match these strings will be removed from the *start* of stack traces. (Once
>  # we hit a non-matching frame, any subsequent frames won't be removed even if
>  # they do match.)
>  allocatorFns = [
> +    'malloc',

Doesn't including malloc/calloc/etc here make the various replace_malloc etc. various redundant?  Because we do a search?  That seems okayish to me, but you're going to match a bunch of new stuff.
Attachment #8538218 - Flags: review?(continuation) → review+
Good point. So let's simplify the list. I'm happy to take the risk of
over-matching -- the likelihood of a non-allocation function containing the
substring malloc/calloc/realloc/memalign is low enough for my liking.
Attachment #8538243 - Flags: review?(continuation)
Attachment #8538243 - Flags: review?(continuation) → review+
Comment on attachment 8538218 [details] [diff] [review]
dmd.py: Add Mac-specific functions to the --alloc-fns list

Thank you for the fast reviews.
Attachment #8538218 - Attachment is obsolete: true
Another one, this time for Windows.
Attachment #8538934 - Flags: review?(continuation)
Comment on attachment 8538934 [details] [diff] [review]
dmd.py: Tweak the --alloc-fns list for better effect on Windows

Review of attachment 8538934 [details] [diff] [review]:
-----------------------------------------------------------------

::: memory/replace/dmd/dmd.py
@@ +36,5 @@
>      # Matches memalign, posix_memalign, replace_memalign, replace_posix_memalign, moz_xmemalign, moz_xposix_memalign, vpx_memalign, malloc_zone_memalign.
>      'memalign',
>      'operator new(',
>      'operator new[](',
> +    'NS_Alloc',

Maybe add NS_Realloc and NS_Free while you are here?  Those are the only other alloc-y functions I see in nsXPCOM.h.
Attachment #8538934 - Flags: review?(continuation) → review+
I'll add NS_Realloc. I'll leave the understanding of NS_Free's omission as an exercise for the reader :)
Oops, right.  But hey we could start recording stacks for deallocation in the future!  And I guess rename the variable.
https://hg.mozilla.org/integration/mozilla-inbound/rev/2c91a808c506
Summary: dmd.py: Add Mac-specific functions to the --alloc-fns list → dmd.py: Add Mac- and Windows-specific functions to the --alloc-fns list
https://hg.mozilla.org/mozilla-central/rev/755f504063f0
https://hg.mozilla.org/mozilla-central/rev/2c91a808c506
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: