Open Bug 1364359 Opened 8 years ago Updated 15 days ago

Properly cleanup thread-local arenas

Categories

(Core :: Memory Allocator, enhancement, P3)

enhancement

Tracking

()

ASSIGNED

People

(Reporter: glandium, Assigned: pbone)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(1 file)

The arenas created in the jemalloc_thread_local_arena function added in bug 1361258 are leaked on purpose. This bug is about not leaking them and properly terminating them (they might not be empty when jemalloc_thread_local_arena(false) is called).
No longer blocks: 1052579
Priority: -- → P3
Blocks: 1377999

Can someone educate me the status of this bug?

I used moz_create_arena in bug 1377999, and I'd like know whether this is a blocker of my patch.

If I can't manually call moz_dispose_arena at the moment, will it be disposed sometime later?

Thanks

(In reply to Sean Feng [:sefeng] from comment #1)

Can someone educate me the status of this bug?

We think bug 1596300 will help out here, it's currently be worked on but is more of proof-of-concept right now.

I used moz_create_arena in bug 1377999, and I'd like know whether this is a blocker of my patch.

It really depends on how many you expect to create and whether or not you can reuse them. Mike probably has a better idea of the overhead of leaving them around.

If I can't manually call moz_dispose_arena at the moment, will it be disposed sometime later?

My understanding is they'll stick around until process shutdown. If these are limited to content processes this might not be a huge issue once fission is enabled.

Flags: needinfo?(mh+mozilla)

What Eric said is accurate. At the moment, using moz_create_arena is not recommended except if the arena is meant to last until the end of the process. So for example, creating an arena for all DOM nodes in a process is fine, but creating an arena for all DOM nodes per page is not (with multiple pages per process).

Flags: needinfo?(mh+mozilla)
Blocks: 1649140
Severity: normal → S3

Note that currently we rely in quite some places on the arena not going away after having done gArenas.GetById outside the the collection's lock. We might be able to ensure that this pattern is used only on the main thread and add some API that allows us to run the effective dispose only ever on the main thread, too. Or in alternative we might want some additional mutex and/or reference counting for arenas.

Bug 1950041 prevented the deletion of all arenas, but this bug still blocks public (thread-local) arena deletion. One potential solution would be either to merge arenas into an orphaned threads arena when a thread terminates, or to delete the arena once its last object is freed.

Thread local arenas can now be destroyed, non-empty thread-local arenas will
be destroyed after their last object is freed, even if that's later from a
different thread. Thread local arenas will be destroyed implicitly when a
thread exits.

Assignee: nobody → pbone
Status: NEW → ASSIGNED
Depends on: 1980064
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: