Commit Graph
430 Commits
Author SHA1 Message Date
Daniel Holbert efbf700080 Bug 2043788: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{base,ds}/. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D303597
2026-05-30 17:24:05 +00:00
agoloman 445c467866 Revert "Bug 2043790: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/tests/. r=xpcom-reviewers,emilio" for causing build bustages @TestNonBlockingAsyncInputStream.cpp.
This reverts commit ed098a6dfc.

Revert "Bug 2043789: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{io,ioutils}/. r=xpcom-reviewers,emilio"

This reverts commit aa8e617fd8.

Revert "Bug 2043788: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{base,ds}/. r=xpcom-reviewers,emilio"

This reverts commit 4f52fb1147.
2026-05-30 17:00:34 +00:00
Daniel Holbert 4f52fb1147 Bug 2043788: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{base,ds}/. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D303597
2026-05-30 15:26:20 +00:00
serge-sans-paille fac0f5e1a8 Bug 2041298 - Comply with clang-tidy's modernize-use-nullptr check for xpcom/ r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D301767
2026-05-25 15:20:21 +00:00
Daniel Holbert 137e1edac0 Bug 2037761: Change RegisterStrongAsyncMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug
This is very similar to the previous patch in this series, but now for the
version of this function with "Async" in the name.

Differential Revision: https://phabricator.services.mozilla.com/D299044
2026-05-07 19:37:47 +00:00
Daniel Holbert a88c0883b9 Bug 2037761: Change RegisterStrongMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug
The callsites now mostly use MakeAndAddRef (which just stuffs a new object into
a RefPtr and calls `forget()` to yield an already_AddRefed).

In cases where the callsite constructs the object earlier and retains a strong
reference, they'll now use do_AddRef to explicitly generate a strong reference
(as an already_AddRefed) to pass into RegisterStrongMemoryReporter.

Differential Revision: https://phabricator.services.mozilla.com/D299042
2026-05-07 19:37:43 +00:00
Sandor Molnar 9987bc0bd7 Revert "Bug 2037761: Change RegisterStrongAsyncMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug" for causing build bustages
This reverts commit 1ab110ab2f.

Revert "Bug 2037761: Change RegisterStrongMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug"

This reverts commit 2e187ddbc8.
2026-05-07 08:23:58 +00:00
Daniel Holbert 1ab110ab2f Bug 2037761: Change RegisterStrongAsyncMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug
This is very similar to the previous patch in this series, but now for the
version of this function with "Async" in the name.

Differential Revision: https://phabricator.services.mozilla.com/D299044
2026-05-07 07:49:45 +00:00
Daniel Holbert 2e187ddbc8 Bug 2037761: Change RegisterStrongMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug
The callsites now mostly use MakeAndAddRef (which just stuffs a new object into
a RefPtr and calls `forget()` to yield an already_AddRefed).

In cases where the callsite constructs the object earlier and retains a strong
reference, they'll now use do_AddRef to explicitly generate a strong reference
(as an already_AddRefed) to pass into RegisterStrongMemoryReporter.

Differential Revision: https://phabricator.services.mozilla.com/D299042
2026-05-07 07:49:42 +00:00
Jeff Muizelaar 3a65805949 Bug 2006953 - Make memory reporter timeout a pref. r=mccr8
I've occasionally run into this timeout for processes that have a lot of
memory. It'd be nice to be able to up the timeout in those situations.

Differential Revision: https://phabricator.services.mozilla.com/D277037
2026-04-10 01:41:15 +00:00
Sylvestre Ledru 6149f49299 Bug 2023419 - Remove Emacs/Vim modelines from xpcom/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287878
2026-03-16 17:22:07 +00:00
Damien Carver 9f29376065 Bug 1635350 - Remove MOZ_GECKO_PROFILER ifdef. r=necko-reviewers,whimboo,geckoview-reviewers,webrtc-reviewers,devtools-reviewers,profiler-reviewers,dom-storage-reviewers,translations-reviewers,canaltinova,TravisLong,valentin,m_kato,jesup,bwc,nchevobbe,jari
The maintenance cost of supporting non-profiler builds now outweighs the benefits.
While previously maintained for Tier 3 platforms, the profiler now supports marker recording across these targets.
Removing this toggle simplifies the build system and allows for faster development.

Differential Revision: https://phabricator.services.mozilla.com/D284849
2026-03-13 08:39:58 +00:00
Silaghi 890797b8d6 Revert "Bug 1635350 - Remove MOZ_GECKO_PROFILER ifdef. r=necko-reviewers,whimboo,geckoview-reviewers,webrtc-reviewers,devtools-reviewers,profiler-reviewers,dom-storage-reviewers,translations-reviewers,canaltinova,TravisLong,valentin,m_kato,jesup,bwc,nchevobbe,jari" for causing build bustages
This reverts commit 9c6ccb9aae.
2026-03-11 14:45:41 +00:00
Damien Carver 9c6ccb9aae Bug 1635350 - Remove MOZ_GECKO_PROFILER ifdef. r=necko-reviewers,whimboo,geckoview-reviewers,webrtc-reviewers,devtools-reviewers,profiler-reviewers,dom-storage-reviewers,translations-reviewers,canaltinova,TravisLong,valentin,m_kato,jesup,bwc,nchevobbe,jari
The maintenance cost of supporting non-profiler builds now outweighs the benefits.
While previously maintained for Tier 3 platforms, the profiler now supports marker recording across these targets.
Removing this toggle simplifies the build system and allows for faster development.

Differential Revision: https://phabricator.services.mozilla.com/D284849
2026-03-11 14:27:55 +00:00
Nika Layzell 4f7a159c2e Bug 2016521 - Part 12: Stop using PLDHashTable in WindowsAddressSpaceReporter, r=win-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D283162
2026-02-18 02:14:13 +00:00
Cristian Tuns 770dd787b8 Revert "Bug 2006953 - Make memory reporter timeout a pref. r=mccr8" for causing build bustages in nsMemoryReporterManager.cpp
This reverts commit de20aed8ca.
2025-12-19 00:32:06 +00:00
Jeff Muizelaar de20aed8ca Bug 2006953 - Make memory reporter timeout a pref. r=mccr8
I've occasionally run into this timeout for processes that have a lot of
memory. It'd be nice to be able to up the timeout in those situations.

Differential Revision: https://phabricator.services.mozilla.com/D277037
2025-12-19 00:07:19 +00:00
serge-sans-paille 5507f1c19a Bug 1995522 - Cleanup remaining unused mfbt includes r=emilio,necko-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,emz,mstange,TYLin,alwu,pehrsons,dom-storage-reviewers,valentin,jari,jwatt,hsingh,edenchuang,janv
Those are the remaining parts required before we land the new mhbt
header inclusion linter

Differential Revision: https://phabricator.services.mozilla.com/D270812
2025-11-16 10:27:57 +00:00
Cristina Horotan 17287b2ae8 Revert "Bug 1995522 - Cleanup remaining unused mfbt includes r=emilio,necko-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,emz,mstange,TYLin,alwu,pehrsons,dom-storage-reviewers,valentin,jari,jwatt,hsingh,edenchuang,janv" for causing conflict on reverting Bug 1998267
This reverts commit d0eaaff18d.
2025-11-15 17:02:19 +00:00
serge-sans-paille d0eaaff18d Bug 1995522 - Cleanup remaining unused mfbt includes r=emilio,necko-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,emz,mstange,TYLin,alwu,pehrsons,dom-storage-reviewers,valentin,jari,jwatt,hsingh,edenchuang,janv
Those are the remaining parts required before we land the new mhbt
header inclusion linter

Differential Revision: https://phabricator.services.mozilla.com/D270812
2025-11-14 12:08:52 +00:00
Ryan VanderMeulen d794b4c091 Bug 1991789 - Remove unnecessary GetApiVersion checks and NewApi suppressions. r=geckoview-reviewers,gfx-reviewers,jnicol,ohall
Differential Revision: https://phabricator.services.mozilla.com/D270353
2025-10-30 11:53:09 +00:00
serge-sans-paille 112b4ba840 Bug 1996697 - Remove unused mfbt inclusion in xpcom/** r=emilio,media-playback-reviewers,profiler-reviewers,profiles-reviewers,chunmin,canaltinova,mossop
Differential Revision: https://phabricator.services.mozilla.com/D270267
2025-10-28 14:33:40 +00:00
serge-sans-paille c961fa4a0b Bug 1993127 - Remove unused inclusion of Attributes.h from xpcom/* r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D269714
2025-10-24 09:33:39 +00:00
Nika Layzell 7d39c30b5b Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-29 16:18:25 +00:00
iulian moraru f5d6849317 Revert "Bug 1979013: apply code formatting via Lando" for causing windows build bustages on MFTEncoder.cpp.
This reverts commit 8c929cc018.

Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"

This reverts commit e01c0a6a32.

Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"

This reverts commit 9f8e73c163.
2025-08-27 23:00:09 +00:00
Nika Layzell e01c0a6a32 Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-27 22:04:15 +00:00
Florian Quèze 55c6fd3ae2 Bug 1950417 - Migrate memory histograms to Glean, making them also available for Firefox Android, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D242035
2025-03-20 19:54:58 +00:00
Jens Stutte 41622444e6 Bug 1903758 - Add an extra jemalloc_free_dirty_pages to the MinimizeMemoryUsageRunnable. r=pbone,smaug
This is most likely only paranoia, but we did not audit all listeners of "memory-pressure" if they do not dispatch other runnables to the main thread that might change the order.

Differential Revision: https://phabricator.services.mozilla.com/D232087
2025-01-17 16:13:30 +00:00
Jens Stutte 43cf0b6065 Bug 1933648 - Have a special array of eternal strong reporters added from nsMemoryReporterManager::Init. r=xpcom-reviewers,nika
StrongReportersTable and WeakReportersTable are hash maps keyed on the reporters pointer, thus its location in memory, which results in a hardly foreseeable execution order when iterating over those tables.
Even more, tweaking jemalloc (as we do in bug 1903758) can easily influence the position of newly allocated objects and thus change the execution order.

To make at least the basic reporters defined by nsMemoryReporterManager itself execute in a deterministic order, we introduce an additional array that holds only the (strong) reporters added in Init().
Those reporters are kept alive until the manager lives and are supposed to be sync when dispatched.

Differential Revision: https://phabricator.services.mozilla.com/D230805
2024-12-05 08:24:34 +00:00
Alexandru Marc 6037d4ec0e Backed out changeset f44fc08292d9 (bug 1933648) for causing Bug 1933942 . a=backout 2024-11-28 15:37:12 +02:00
Jens Stutte 6b523c4b5b Bug 1933648 - Have a deterministic order for nsIMemoryReporter execution, starting from JemallocHeapReporter. r=xpcom-reviewers,mccr8
StrongReportersTable and WeakReportersTable are hash maps keyed on the reporters pointer, thus its location in memory, which results in a hardly foreseeable execution order when iterating over those tables.
Even more, tweaking jemalloc (as we do in bug 1903758) can easily influence the position of newly allocated objects and thus change the execution order.

This patch makes it so that the execution order is deterministic and starts from the most sensible reporters based on the order with which they are registered in nsMemoryReporterManager::Init.
The easiest way to achieve this is to keep the order with which they are added using an array (the operations are believed to not be time critical).

Differential Revision: https://phabricator.services.mozilla.com/D230358
2024-11-27 21:42:02 +00:00
Sylvestre Ledru a3ea006705 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Paul Bone 8339509cc6 Bug 1885466 - Rename jemalloc_stats::page_cache to pages_dirty r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D204724
2024-03-28 02:41:09 +00:00
Paul Bone 09c11af7e9 Bug 1878806 - pt 2. Add about:memory entries for fresh and madvised pages r=mccr8,glandium
Differential Revision: https://phabricator.services.mozilla.com/D200750
2024-03-26 05:06:15 +00:00
Paul Bone a6944726a3 Bug 1878806 - pt 1. Move mozjemalloc stats into their own tree r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D200749
2024-03-26 05:06:15 +00:00
Paul Bone 3fec5a84b4 Bug 1854550 - pt 9. Move PHC interface from the bridge to PHC.h r=glandium
Building PHC in a unified build now also works.

Differential Revision: https://phabricator.services.mozilla.com/D191133
2023-10-19 06:38:42 +00:00
Sylvestre Ledru b0fe72dee5 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan 7388749830 Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru 4a97019e39 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Nika Layzell f56b27a28d Bug 1851045 - Part 3: Fix potential issue with late shutdown nsThread creation, r=xpcom-reviewers,KrisWright
This fixes the issue described in comment 7 by doing a few changes to how threads are created, and members on nsThreadManager are managed.

 * The thread list is moved to be a member of `nsThreadManager`, which is
   already a statically allocated singleton.

 * The flag for whether new thread creation is allowed is moved from being an
   atomic to being guarded by the same mutex as the thread list, meaning that
   it could be checked and a new thread could be added to the list atomically.

 * Threads which require shutdown are initialized atomically from the point of
   view of the thread manager, meaning that the check in ShutdownNonMainThreads
   is guaranteed to catch all successfully started nsThread instances.

Differential Revision: https://phabricator.services.mozilla.com/D188623
2023-09-27 19:14:16 +00:00
Iulian Moraru 4a4a6a9477 Backed out 3 changesets (bug 1851045) for causing multiple crashes related to LinkedList.
Backed out changeset c813616ed664 (bug 1851045)
Backed out changeset c53ebef234df (bug 1851045)
Backed out changeset 3350d1b78562 (bug 1851045)
2023-09-21 03:07:37 +03:00
Nika Layzell 4cd32e8655 Bug 1851045 - Part 3: Fix potential issue with late shutdown nsThread creation, r=xpcom-reviewers,KrisWright
This fixes the issue described in comment 7 by doing a few changes to how threads are created, and members on nsThreadManager are managed.

 * The thread list is moved to be a member of `nsThreadManager`, which is
   already a statically allocated singleton.

 * The flag for whether new thread creation is allowed is moved from being an
   atomic to being guarded by the same mutex as the thread list, meaning that
   it could be checked and a new thread could be added to the list atomically.

 * Threads which require shutdown are initialized atomically from the point of
   view of the thread manager, meaning that the check in ShutdownNonMainThreads
   is guaranteed to catch all successfully started nsThread instances.

Differential Revision: https://phabricator.services.mozilla.com/D188623
2023-09-20 21:46:05 +00:00
Paul Bone bab2dfabbe Bug 1831852 - Avoid extra call to jemalloc_stats in telemetry r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D177596
2023-05-11 04:40:44 +00:00
Paul Bone 309a477c41 Bug 1831852 - Use const refs for the HeapOverhead parameter r=mccr8
Improve style by using const refs rather than raw pointers for these
functions.

Differential Revision: https://phabricator.services.mozilla.com/D177595
2023-05-11 04:40:44 +00:00
Andrew McCreight 43a7ece656 Bug 1806852 - Use nsThread::GetThreadName in the threads memory reporter. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D176191
2023-04-21 22:00:55 +00:00
Paul Bone e2a51aae2f Bug 1825467 - Add missing include r=cosmins
Differential Revision: https://phabricator.services.mozilla.com/D174086
2023-03-30 11:51:46 +00:00
Paul Bone 2f8dd751d0 Bug 1822451 - Add about:memory entries for PHC r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D173099

Depends on D173098
2023-03-29 11:08:17 +00:00
Cosmin Sabou e451c9aafd Backed out 3 changesets (bug 1822451) for busting thunderbird builds and causing bug 1825467. CLOSED TREE
Backed out changeset 5c399ec3dae0 (bug 1822451)
Backed out changeset ac5d1057c562 (bug 1822451)
Backed out changeset 42250977529b (bug 1822451)
2023-03-30 14:30:22 +03:00
Cosmin Sabou 8498353405 Backed out changeset e5b65704ade8 (bug 1825467) for causing asan/tsan build bustages on nsMemoryReporterManager.cpp. 2023-03-30 14:23:02 +03:00
Paul Bone 20f32c7a73 Bug 1825467 - Add missing include r=CosminS
Differential Revision: https://phabricator.services.mozilla.com/D174086
2023-03-30 10:50:56 +00:00