malloc_usable_size is also available in libc on FreeBSD

RESOLVED FIXED in mozilla17

Status

()

Core
Memory Allocator
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Jan Beich, Unassigned)

Tracking

Trunk
mozilla17
All
FreeBSD
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Reporter)

Comment 1

5 years ago
FreeBSD has jemalloc in base since 7.0 with working malloc_usable_size (unlike NetBSD).
It was updated to 3.0.0 in 10.0-CURRENT (2012-04-17).
(Reporter)

Comment 2

5 years ago
Created attachment 646484 [details] [diff] [review]
fix the warning in about:memory when using system malloc

--enable-jemalloc build fails:

/a/mozilla-central/memory/mozalloc/mozalloc.cpp:215:12: error: use of undeclared identifier
      'malloc_usable_size'; did you mean 'moz_malloc_usable_size'?

while default build has:

$ firefox -P test -no-remote about:memory
WARNING: the 'heap-allocated' memory reporter and the moz_malloc_usable_size() function do not work for this platform and/or configuration.  This means that 'heap-unclassified\
' is not shown and the 'explicit' tree shows much less memory than it should.

WARNING: the following values are negative or unreasonably large.
 explicit/window-objects/top(chrome://browser/content/browser.xul, id=1)/active/window(chrome://browser/content/browser.xul)/layout/pres-shell
 explicit/window-objects/top(about:memory, id=8)/active/window(about:memory)/js/compartment([System Principal], about:memory)/analysis-temporary
 explicit/window-objects/top(about:memory, id=8)/active/window(about:memory)/layout/pres-shell
 explicit/window-objects/top(about:memory, id=8)/active/window(about:blank)/js/compartment(about:blank)/analysis-temporary
 explicit/window-objects/(3 tiny)/top(about:blank, id=7)/active/window(about:blank)/js/compartment(about:blank)/analysis-temporary
 explicit/window-objects/(3 tiny)/top(about:blank, id=5)/active/window(about:blank)/js/compartment(about:blank)/analysis-temporary
 explicit/window-objects/(3 tiny)/top(resource://gre-resources/hiddenWindow.html, id=3)/active/window(resource://gre-resources/hiddenWindow.html)/layout/pres-shell
 js-main-runtime/compartments/(3 tiny)/analysis-temporary
 window-objects/layout/rule-nodes
 window-objects/layout/frames
 window-objects/layout/style-contexts
 window-objects/layout/line-boxes
 window-objects/layout/pres-shell
This indicates a defect in one or more memory reporters.  The invalid values are highlighted.

After applying the patch:

$ firefox -P test -no-remote about:memory
WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.
Attachment #646484 - Flags: review?(justin.lebar+bug)
Comment on attachment 646484 [details] [diff] [review]
fix the warning in about:memory when using system malloc

Cool.

https://hg.mozilla.org/integration/mozilla-inbound/rev/93a4e2bbcd95

btw, most Mozilla hackers are not set up to push git-formatted patches to hg, so would have had some difficulty with this patch.  You can convert git patches to hg patches using git-patch-to-hg-patch in moz-git-tools [1].

It's also customary to attach patches with 8 lines of context.

git-bz (also in moz-git-tools) is a bit of a pain to set up, but will do all this for you.

[1] https://github.com/jlebar/moz-git-tools
Attachment #646484 - Flags: review?(justin.lebar+bug) → review+
https://hg.mozilla.org/mozilla-central/rev/93a4e2bbcd95
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
(Reporter)

Updated

5 years ago
Blocks: 791366
You need to log in before you can comment on or make changes to this bug.