Closed Bug 1417234 Opened 7 years ago Closed 7 years ago

Use SRWLock as Mutex for mozjemalloc on Windows

Categories

(Core :: Memory Allocator, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

      No description provided.
Comment on attachment 8928302 [details]
Bug 1417234 - Use SRWLock as Mutex for mozjemalloc on Windows.

https://reviewboard.mozilla.org/r/199518/#review204666

::: memory/build/mozjemalloc.cpp
(Diff revision 2)
> -{
> -  switch (reason) {
> -    case DLL_PROCESS_ATTACH:
> -      // Don't force the system to page DllMain back in every time
> -      // we create/destroy a thread
> -      DisableThreadLibraryCalls(hModule);

DisableThreadLibraryCalls should be called regardless of this change.
Comment on attachment 8928302 [details]
Bug 1417234 - Use SRWLock as Mutex for mozjemalloc on Windows.

https://reviewboard.mozilla.org/r/199518/#review204672

Ok by me. I don't know enough about DisableThreadLibraryCalls() to have an opinion on emk's suggestion.
Attachment #8928302 - Flags: review?(n.nethercote) → review+
(In reply to Masatoshi Kimura [:emk] from comment #3)
> Comment on attachment 8928302 [details]
> Bug 1417234 - Use SRWLock as Mutex for mozjemalloc on Windows.
> 
> https://reviewboard.mozilla.org/r/199518/#review204666
> 
> ::: memory/build/mozjemalloc.cpp
> (Diff revision 2)
> > -{
> > -  switch (reason) {
> > -    case DLL_PROCESS_ATTACH:
> > -      // Don't force the system to page DllMain back in every time
> > -      // we create/destroy a thread
> > -      DisableThreadLibraryCalls(hModule);
> 
> DisableThreadLibraryCalls should be called regardless of this change.

DllMain is only ever called for the dll it resides in. Meaning that DisableThreadLibraryCalls is only ever called here for the dll mozjemalloc resides in.

DisableThreadLibraryCalls avoids that DllMain function to be called for DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications. The only other thing that this DllMain function did is call malloc_init_hard, which goes away. Thus there's nothing left for that DllMain to do in any situation. Removing the function makes it never called, which is a superset of what DisableThreadLibraryCalls did.
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/5b8cbab9374f
Use SRWLock as Mutex for mozjemalloc on Windows. r=njn
https://hg.mozilla.org/mozilla-central/rev/5b8cbab9374f
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: