Last Comment Bug 778056 - malloc_usable_size is also available in libc on FreeBSD
: malloc_usable_size is also available in libc on FreeBSD
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Memory Allocator (show other bugs)
: Trunk
: All FreeBSD
: -- normal (vote)
: mozilla17
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks: 791366
  Show dependency treegraph
 
Reported: 2012-07-26 23:51 PDT by Jan Beich
Modified: 2012-09-16 17:47 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix the warning in about:memory when using system malloc (1.24 KB, patch)
2012-07-27 00:48 PDT, Jan Beich
justin.lebar+bug: review+
Details | Diff | Splinter Review

Description Jan Beich 2012-07-26 23:51:05 PDT

    
Comment 1 Jan Beich 2012-07-26 23:56:33 PDT
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).
Comment 2 Jan Beich 2012-07-27 00:48:44 PDT
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.
Comment 3 Justin Lebar (not reading bugmail) 2012-07-27 11:18:10 PDT
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
Comment 4 Ryan VanderMeulen [:RyanVM] 2012-07-28 18:37:55 PDT
https://hg.mozilla.org/mozilla-central/rev/93a4e2bbcd95

Note You need to log in before you can comment on or make changes to this bug.