With heap scan mode, the DMD log includes the address of every block.
This patch includes the addresses in the output, if they are present.
This is useful when no cycle collected objects are leaked.
Differential Revision: https://phabricator.services.mozilla.com/D214880
With heap scan mode, the DMD log includes the address of every block.
This patch includes the addresses in the output, if they are present.
This is useful when no cycle collected objects are leaked.
Differential Revision: https://phabricator.services.mozilla.com/D214880
The Arena ID is wrapped in a Maybe, the construction of Nothing() shows up
in profiles. By testing the maybe we show the compiler that it can optimise
away the construction of Nothing when inlining this code.
Differential Revision: https://phabricator.services.mozilla.com/D207680
+ Move sNow into the PHC class and put it next to mMutex, they're
frequently modified together.
+ Reorganise PHC fields to place frequently-updated-together fields
together, and separate them from the seldom-updated fields.
+ The only static fields remaining are write-once.
Differential Revision: https://phabricator.services.mozilla.com/D210468
This change optimises the PHC hot path by reducing updates to sAllocDelay
and sNow:
* tlsAllocDelay has been created to create thread-local allocation delays,
when they expire then the shared sAllocDelay is checked.
* sNow is updated only when not executing the fast path.
This change also:
* Previously the thread that saw sAllocDelay == 0 would be the one to make
the allocation, the ReleaseAquire semantics ensured that exactly one
thread would see this. Now all threads that see sAllocDelay <= 0 will
attempt a PHC allocation, this is later checked by atomically resetting
sAllocDelay.
* Removes the logic that checks if the delay has wrapped
while PHC was disabled on the current thread. This isn't needed anymore
because we now make PHC allocations for all sAllocDelay < 0, assuming
that threads are disabled for less than UINT32_MAX/2 allocations.
* Moves ShouldMakeNewAllocations out of the hot-path.
Differential Revision: https://phabricator.services.mozilla.com/D206469
This patch co-locates mMutex with the data it protects and is accessed
together. It was previously located with global write-once data and updates
to `sMutex` were caused cache misses for `sPHC`.
Making `mMutex` a member variable also makes sense conceptually.
Differential Revision: https://phabricator.services.mozilla.com/D210466
I know this and some of the other refactoring patches are going to make
things more verbose (eg PHC::sPHC-> prefixing everything). I intend to
follow up later and move more of PHC's code into the PHC class which will
then reduce the need for those pointers and scopes.
Differential Revision: https://phabricator.services.mozilla.com/D210463
This and the refactoring changes to follow are moving more of PHC's data
into one class. From within there we can group it by how its accessed and
control which data is nearby other data to control cache line sharing.
sAllocDelay is always initialised by the GMut() constructor. It is later
re-initialised from SetState() but that could be after PHC is already
active.
Differential Revision: https://phabricator.services.mozilla.com/D206468
Currently we have 3 structures containing mutable data seperated by their
lock-safe behaviour (locked, atomic and TLS). I'd prefer to associate
structures by what they mean. This patch moves the `tlsIsDisabled`
variable, the only one in `GTls` into `GMutable` and removes the `GTls`
class.
Differential Revision: https://phabricator.services.mozilla.com/D206466
The -ldl flag was previously set globally, it's now set for the libs
that use it.
Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.
Differential Revision: https://phabricator.services.mozilla.com/D203594
The -ldl flag was previously set globally, it's now set for the libs
that use it.
Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.
Differential Revision: https://phabricator.services.mozilla.com/D203594
The -ldl flag was previously set globally, it's now set for the libs
that use it.
Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.
Differential Revision: https://phabricator.services.mozilla.com/D203594
The functions were wrapped in bug 1280578 mainly for rust, which used
these functions for its global allocator. However, that use case went
away with bug 1514122, where we've set up our own global allocator for
rust that calls the malloc-family of functions directly instead.
Back in that bug, we left the HeapAlloc wrapping for other use cases,
but there are few of them left, but we're now hitting another problem,
where we actually do want to be able to HeapFree pointers that might
have been allocated by system libraries, and the wrapping is getting
on the way of this actually working.
Differential Revision: https://phabricator.services.mozilla.com/D205788
Using CHUNK_MAP_FRESH for double purged pages is better than overloading
the CHUNK_MAP_DECOMMITTED bit with two different semantics. It also allows
us to simplify some code.
Differential Revision: https://phabricator.services.mozilla.com/D203571
This memory was previously measured as part of committed memory. However
depending on the OS it will often not be committed. It's more accurate to
count it separately as part of mozjemalloc's cache of unused pages.
This patch adds counters for both fresh and madvised memory and no-longer
counts either as "committed" as it previously did.
This has the side effect of changing decisions based on the size of this
cache such as when to purge memory.
Differential Revision: https://phabricator.services.mozilla.com/D200415
This breaks the old invariant that there are no committed pages that aren't
either allocated or dirty. There is now also new code in DeallocChunk that
counts the number of "fresh" committed pages and adjusts mStats.committed.
Differential Revision: https://phabricator.services.mozilla.com/D195514
The decommit logic is now only used when MALLOC_DECOMMIT is defined. The other
page bits ( CHUNK_MAP_MADVISED and CHUNK_MAP_FRESH) are cleared when the page
is initialised. This avoids leaving the chunk map in an inconsistent state if
pages_commit should fail.
These changes will make some following patches simpler.
Differential Revision: https://phabricator.services.mozilla.com/D200414