Closed Bug 431221 Opened 16 years ago Closed 16 years ago

Disable glib slice allocator

Categories

(Core :: Memory Allocator, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jasone, Assigned: jasone)

References

Details

(Keywords: mobile)

Attachments

(2 files, 1 obsolete file)

glib provides a slice API[1], which is implemented as a zone allocator layered
on top of malloc.  Since jemalloc is itself a zone allocator, the extra
abstraction level forces segregation of equal-sized objects that could
otherwise be packed together.

I ran the talos benchmark and plotted the memory usage for tp (see attachment).  Mapped memory (tp_Private Bytes) is markedly lower if the slice allocator is disabled.  Resident set size (tp_RSS) also appears to be slightly lower, on the order of 1-2%.  A longer run may show more significant fragmentation reduction.

[1] http://library.gnome.org/devel/glib/stable/glib-Memory-Slices.html
Attached patch Disable glib slice allocator (obsolete) — Splinter Review
Attachment #318233 - Flags: review?(doug.turner)
Comment on attachment 318233 [details] [diff] [review]
Disable glib slice allocator

this looks like the right thing, but bsmedberg is the guy to review it.

does /dev/null always exist on every unix platform we care about?

Do all application on linux using jemalloc use run-mozilla.sh (xulrunner, ff, tb?)  I am wondering if we can do this inside of the app programmatically?  (probably too late?)
Attachment #318233 - Flags: review?(doug.turner) → review?(benjamin)
Keywords: mobile
Instead of using >/dev/null, simply close the fd with >-
Could we use 'sh' builtin commands to avoid starting a new process?
For example:
: ${G_SLICE:=always-malloc}
Just match existing usage in run-mozilla.sh with

if [ -z "$G_SLICE" ]
then
  G_SLICE=always-malloc
  export G_SLICE
fi
Comment on attachment 318233 [details] [diff] [review]
Disable glib slice allocator

yeah, use test -z "$G_SLICE"

But, is there really no way to do this programmatically from main()?
Attachment #318233 - Flags: review?(benjamin) → review-
Re: [ -z "$G_SLICE" ], I specifically avoided that construct because it overrides an empty, but existing, G_SLICE environment variable.  My intention was to be minimally disruptive.

That said, the attached patch unconditionally disables the slice allocator programmatically.
Attachment #318233 - Attachment is obsolete: true
Attachment #318448 - Flags: review?(benjamin)
Attachment #318448 - Flags: review?(benjamin) → review+
i know that some people like trying to make /dev/zero readonly and it seems some people also like to make /dev/null readonly. not sure if you care. I do know that we've had talkback crash reports (i.e. user complains talkback is broken) for one of those two cases (I can't remember which).
Assignee: jasone → nobody
Status: ASSIGNED → NEW
Component: Startup and Profile System → jemalloc
Product: Firefox → Core
QA Contact: startup → jemalloc
Status: NEW → ASSIGNED
Assignee: nobody → jasone
Status: ASSIGNED → NEW
changeset:   15459:621becf19fe6
user:        Jason Evans <jasone@canonware.com>
date:        Fri Jun 20 10:34:42 2008 -0700
summary:     Bug 431221: Disable glib slice allocator, r=benjamin
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
(In reply to comment #8)
> i know that some people like trying to make /dev/zero readonly and it seems
> some people also like to make /dev/null readonly. 

offtopic, but doing either is completely deranged and not worth supporting; more so for the latter; i'm amazed the system even boots with a read-only null device.
Depends on: 669130
Blocks: 778078
Depends on: 833117
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: