Closed Bug 815681 Opened 12 years ago Closed 11 years ago

xpcom/base/AvailableMemoryTracker.cpp:502:3: error: use of undeclared identifier 'mallctl' with --enable-jemalloc

Categories

(Firefox Build System :: General, defect)

20 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: octoploid, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20.0 Firefox/20.0
Build ID: 20121126205642

Steps to reproduce:

Build Firefox with  "ac_add_options --enable-jemalloc"


Actual results:

MapsMemoryReporter.cpp
/var/tmp/mozilla-central/xpcom/base/AvailableMemoryTracker.cpp:502:3: error: use of undeclared identifier 'mallctl'
  mallctl("arenas.purge", nullptr, 0, nullptr, 0);
  ^
1 error generated.
Caused by:
commit 31af229c900aaa89f49d6afb5ce0a703b592081d
Author: Gabriele Svelto <gsvelto@mozilla.com>
Date:   Mon Nov 12 17:41:23 2012 +0100

    Bug 805855 - Free dirty pages in response to all memory-pressure messages. r=jlebar
Attached patch fix (obsolete) — Splinter Review
This patch fixes the issue.
(In reply to Octoploid from comment #2)
> This patch fixes the issue.

I tested your patch on my B2G desktop build (which uses mozjemalloc, but not jemalloc3) and I get the same error, that's because with your patch applied I'm using mozjemalloc and mallctl() (which is provided by jemalloc3) is being called. AFAIK when MOZ_MEMORY is defined we're using mozjemalloc so we should call jemalloc_free_dirty_pages(), when MOZ_JEMALLOC is defined we're using jemalloc3 built from the sources under memory/jemalloc so we should be calling mallctl(). Maybe the proper solution would be to include jemalloc.h if either MOZ_MEMORY or MOZ_JEMALLOC are defined, it might be that it's not being included when using --enable-jemalloc.
Attached patch new fixSplinter Review
mallctl() isn't defined when MOZ_JEMALLOC is defined.
So the new patch should be OK.
Attachment #685683 - Attachment is obsolete: true
It's not what I expected but it seems you're right, though looking at the configure script it seems that MOZ_JEMALLOC is currently being set only when MOZ_NATIVE_JEMALLOC is also being set (which is when using the system's jemalloc library). I'm CC'ing Mike Hommey because he can certainly shed some light on this.
MOZ_JEMALLOC is something you set manually at the moment, when you want to test jemalloc3. Fixing this build error the right way is tricky at the moment, but it's also fixed by the patches from bug 804303.

I doubt --enable-jemalloc alone can trigger this failure. In fact, --enable-jemalloc is the default, and we don't fail to build on build slaves.
Depends on: replace-malloc
(In reply to Mike Hommey [:glandium] from comment #6)
> MOZ_JEMALLOC is something you set manually at the moment, when you want to
> test jemalloc3. Fixing this build error the right way is tricky at the
> moment, but it's also fixed by the patches from bug 804303.
> 
> I doubt --enable-jemalloc alone can trigger this failure. In fact,
> --enable-jemalloc is the default, and we don't fail to build on build slaves.

Your right. I'm using:
...
ac_add_options --enable-jemalloc
export MOZ_JEMALLOC=1
...
I'd be okay with removing the mallctl call on aurora. For mozilla-central, we can wait for bug 804303.
Component: Untriaged → Build Config
Should have been fixed by bug 804303 which is part of the last Release.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Component: Build Config → General
Product: Firefox → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: