Closed Bug 814312 Opened 12 years ago Closed 12 years ago

Avoid PL_ArenaPool recycling in the layout engine.

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

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

Details

(Whiteboard: [MemShrink])

Attachments

(1 file)

PLArenaPool has a global free list of chunks. If you call PL_FreeArenaPool (as opposed to PL_FinishArenaPool) any outstanding chunks in the arena pool are put on the free list. As a result, the free list can have chunks of any size, and arbitrarily-sized chunks can be handed out to any other arena pool. In other words, the sizing of the chunks obtained by any one arena pool depends partially on what other arena pools do(!) Furthermore, this recycling of chunks is really confusing when looking at heap profiles (e.g. from DMD) because chunks that were allocated by one arena pool may be (a) on the free list, or even worse (b) held by another arena pool. (I spent 20 minutes scratching my head over a (b) case before bz explained about the free list.) My experience is that if you have a decent allocator (such as jemalloc) it's simpler and better to let it do this kind of chunk recycling for you. (See bug 715770 for a related example.)
This patch changes two places in the layout engine that call PL_FreeArenaPool() and then PL_FinishArenaPool(), so they instead just call the latter. This avoids the recycling behaviour. This reduces the amount of memory held on the free list from typically a few 10s of KiBs to typically zero. (There's a use in NSS that causes it to rise to ~300KiB at shut-down, but that's not worth fixing.)
Attachment #684315 - Flags: review?(roc)
Whiteboard: [MemShrink]
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: