Closed Bug 1557907 Opened 5 years ago Closed 5 years ago

Fix `jemalloc_replace_dynamic()`.

Categories

(Core :: Memory Allocator, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

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

References

Details

Attachments

(1 file)

This is needed for PHC (bug 1523276).

Blocks: 1523276

jemalloc_replace_dynamic() is badly broken. If you install a malloc table
other than the default at startup (e.g. DMD's or PHC's), when you call
jemalloc_replace_dynamic() it installs a new allocator that wraps the
default allocator, and then when you call jemalloc_replace_dynamic(nullptr)
it switches back to the default allocator.

This commits makes numerous improvements.

  • It removes the "flip-flopping" between malloc tables, which didn't really
    work and isn't necessary.

  • jemalloc_replace_dynamic() now switches between the original malloc table
    and the new one, rather than the default malloc table and the new one.

  • It renames various things, to make the names shorter and clearer.

  • It clearly documents the dangers and limitations of
    jemalloc_replace_dynamic().

  • It removes and inlines profiler::Init(), because there was only one call
    site.

  • It rearranges install_memory_counter() so the control flow is simpler.

Pushed by nnethercote@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e07990ce888f Fix `jemalloc_replace_dynamic()`. r=glandium
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Assignee: nobody → n.nethercote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: