122 Commits
Author SHA1 Message Date
Chris Kennelly CA 27112c82fb Fold CentralFreeList's StaticForwarder into StaticForwarder.
The out-of-line definitions in central_freelist.cc become inline members of
the template, so central_freelist.cc is deleted.  central_freelist.h forward
declares StaticForwarder, since static_forwarder.h depends on it via
parameters.h.

The StaticForwarderSpanTest cases, previously moved to
static_forwarder_test.cc, are retargeted to the production forwarder.  The
small-but-slow TransferCacheManager is templated on its forwarder, as the
default one is, so that CentralFreeList's members are only instantiated where
used.

PiperOrigin-RevId: 998314669
2026-10-12 19:52:59 -07:00
Chris Kennelly CA 2e6ffc8815 Document gcc 12.1 as the minimum supported compiler in platforms.md.
tcmalloc/internal/config.h rejects GCC older than 12.1 (and Clang older
than 11) at preprocessing time.

PiperOrigin-RevId: 981638085
2026-09-15 01:11:27 -07:00
Chris Kennelly CA 411000090d Remove stale proxy object references from sampling documentation.
These no longer exist.

PiperOrigin-RevId: 978575560
2026-09-09 08:51:43 -07:00
Steinar H. Gunderson ea99e09225 Require asm goto support unconditionally for rseq.
Clang 11 (which added asm goto support) was released almost
six years ago, and GCC has supported this since about 2010.
Clean it up so that the code is easier to read.

Unfortunately, GCC has grown a new regression in the meantime
(supposedly wrong code from GCC 14, ICE from GCC 16), so add
a smaller workaround until it is hopefully fixed in 16.3.

PiperOrigin-RevId: 970561435
2026-08-25 08:10:59 -07:00
TCMalloc Team b06a3d11e6 Rename Reclaim to Drain.
cpu_cache.h calls this Reclaim, but TcmallocSlab and most people
seem to call it Drain. Rename so that we use only one term
for what is the same operation.

PiperOrigin-RevId: 967665500
2026-08-20 01:50:24 -07:00
Vaibhav Gogte 10912d748e Print low water mark in HugeRegion to telemetry.
PiperOrigin-RevId: 962846611
2026-08-11 10:07:31 -07:00
Chris Kennelly d488081be6 Update sampling documentation for object placement.
The current text implies that all sampled objects are placed on the sampled
heap and not hugepage'd, but this only applies to objects smaller than
`kMaxSize` (typically 256KB).

PiperOrigin-RevId: 949562209
2026-07-17 07:38:50 -07:00
Chris Kennelly 5d57ce286e Update freshness.
PiperOrigin-RevId: 945134483
2026-07-09 08:36:46 -07:00
Chris Kennelly 1458073302 Add TCMALLOC_INTERNAL_LATENCY_INJECTION build mode to TCMalloc.
This adds a new build mode to TCMalloc that can be enabled by setting
TCMALLOC_INTERNAL_LATENCY_INJECTION. This mode introduces delay
injection at 4 critical points in the allocator:

1. Page Heap SpinLock acquisition
2. Central FreeList SpinLock acquisition
3. per-CPU Cache UpdateMaxCapacities
4. per-CPU Cache ResizeSlabs

These latency injections are inspired by Coz (https://arxiv.org/abs/1608.03676).

PiperOrigin-RevId: 893785128
Change-Id: Iea28741fd89a0eedcae15b7a4091f28a367f01b7
2026-04-02 17:23:13 -07:00
Qian Ge c0a9568814 Remove the unused debugging information from huge page subrelease.
PiperOrigin-RevId: 885312002
Change-Id: I75ab6ab58918ff2213216a8d5b26803085fc0d97
2026-03-17 18:35:31 -07:00
Qian Ge 5a317465d6 Clean up comments and docs.
PiperOrigin-RevId: 879254089
Change-Id: I6f4c15fa3e4e17344918511346979c0a3d211af5
2026-03-05 14:43:23 -08:00
Chris Kennelly c6d7855d55 Update last reviewed date.
PiperOrigin-RevId: 874663016
Change-Id: Ie21bfbfeb7b781a0750f05cd36db5e3b0e1182c0
2026-02-24 09:57:38 -08:00
Patrick Xia a1c28cbc34 docs-only: sampling.md: switch diagram to ASCII art
this is terrible. GitHub processes markdown before LaTeX, so it does things
like & -> &, * -> _, and \! -> ! transforms before giving it to the LaTeX
parser, which also just completely ignores \boxed and fatals on \phantom. The
only cross-platform way to get this to work is ASCII art.

PiperOrigin-RevId: 871476854
Change-Id: Iffbd32c747290b985391dc3bb7c310865726ea7c
2026-02-17 13:44:33 -08:00
Chris Kennelly d4298367a9 Document lightweight UB checks.
PiperOrigin-RevId: 848275603
Change-Id: Ia8b2fca0a31cd1d82e35142c34acac960b7ef271
2025-12-23 13:11:27 -08:00
Chris Kennelly 49819e4c63 Add anchor to documentation header.
PiperOrigin-RevId: 797908488
Change-Id: I21776943c97bb039c4b150463808cca896e0ecf6
2025-08-21 14:13:21 -07:00
Chris Kennelly 85fbbdbe41 Update docs.
PiperOrigin-RevId: 796912046
Change-Id: Id583578ebc577a7950ce4ac92e4768eae154d640
2025-08-19 09:46:27 -07:00
Chris Kennelly b57be8cba1 Revert: Introducing demand-based release mechanism to HugeCache.
PiperOrigin-RevId: 794616763
Change-Id: Iaa06439ff77d2245d1ac49bd9a931c72b2ceb596
2025-08-13 09:37:42 -07:00
Chris Kennelly 767deb01c5 No public description
PiperOrigin-RevId: 757880659
Change-Id: Id86af8c3d606cc7ebfa87173eeb4a1f31240f8e2
2025-05-12 13:06:09 -07:00
Chris Kennelly 0c5f4bfa16 Implement further sampled hook support details (#44).
PiperOrigin-RevId: 752793674
Change-Id: I2f2ff9b2778ae3ed1aaeff9942160598377e6225
2025-04-29 10:36:10 -07:00
TCMalloc Team e780ef28b8 Adding a bit of guidance about which crash stacks to focus on when debugging the mismatched sized delete diagnostic.
PiperOrigin-RevId: 716695791
Change-Id: Ib7f65f84b64dca51896efef8ad1d8d32062452d4
2025-01-17 09:25:53 -08:00
Todd Lipcon d02a005a36 Check for size class mismatches when inserting objects back into the CentralFreeList
PiperOrigin-RevId: 713705122
Change-Id: I88af986c3aa5ddff8d7ee5fd1fa030d495b3b133
2025-01-09 09:50:01 -08:00
Chris Kennelly 6645992792 Fix various typos.
PiperOrigin-RevId: 709208903
Change-Id: I7782d017936579338914f267c0e598e0fe30c870
2024-12-23 19:10:04 -08:00
Chris Kennelly 0a0b79928f Document mismatched sized delete error.
PiperOrigin-RevId: 703507797
Change-Id: Ia984e14c38dca178008da04923950ac663aab4c4
2024-12-06 08:26:53 -08:00
Chris Kennelly cb7f6acb8c Update TCMalloc publication list.
PiperOrigin-RevId: 668012234
Change-Id: Ib1fbc042874146f85d57718a6841af614b699937
2024-08-27 09:10:16 -07:00
Qian Ge c38ba76b0f Introducing demand-based release mechanism to HugeCache.
When enabled, HugeCache uses the recent demand history to guide its release decisions: it would reduce the target if those free hugepages will likely be reallocated soon. Note, it would only try to optimize for the background non-urgent release requests.

PiperOrigin-RevId: 655755775
Change-Id: I8380ea044e28756066d6feb7f180647af4b8c163
2024-07-24 17:32:56 -07:00
Marco Elver dbb4b9d51a docs: Update references to sampling interval
A recent change fixed the names of the sampling "rate" to "interval": the
profile sampling interval denotes the number of bytes between allocations.

Update the wording in documentation to use the correct terminology.

PiperOrigin-RevId: 643331112
Change-Id: Ic4f7cc733de9d6ca0d9d45d830bcd2e6a996b941
2024-06-14 06:57:38 -07:00
Qian Ge bc446f3ead docs-only: updating description of object lifetime profiling.
PiperOrigin-RevId: 631080209
Change-Id: I35fa57850f71c77f19742f13ae288998879dea67
2024-05-06 09:08:21 -07:00
Dmitry Vyukov aa90692cc7 4-byte slab headers.
Currently the slab header is 8 bytes and holds [begin, current, end] indices.
This change switches to the new scheme where the header is 4 bytes and
holds only [current, end] indices. Begin indices are stored in a separate array
and are used only in slower operations.

In the new scheme we mark the stub element stored before the size class range
(the one that we use for prefetching when we pop the last element) with
low bit set. This allows to easily understand when we reached the begin
of the range during pop.

Currently Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 8), %[current]
      cmpw 2(%[scratch], %[size_class], 8), %w[current]
      jbe %l[underflow_path]
      movq -8(%[scratch], %[current], 8), %[result]

In the new scheme Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 4), %[current]
      movq -8(%[scratch], %[current], 8), %[result]
      testb $1, %b[result]
      jnz %l[underflow_path]

Effectively we trade:
  5167ca: 66 45 3b 4c d0 02            	cmpw	0x2(%r8,%rdx,8), %r9w
for:
  516654: a8 01                        	testb	$0x1, %al

This has several advantages: -1 load, -4 instruction bytes, but more importantly
fewer hot cache lines in L1D$ (~5 instead of 10).

Note: this required to move TcmallocSlab initialization a bit earlier in CpuCache,
so that we don't try to pop from uninitialized slab.

Microbenchmark results with -no-pie:
                                │   sec/op   │  sec/op     vs base             │
BM_new_delete/8                  9.091n ± 0%  8.851n ± 0%  -2.65% (p=0.000 n=20)
BM_new_delete/64                 9.111n ± 0%  8.873n ± 0%  -2.62% (p=0.000 n=20)
BM_new_sized_delete/8            3.585n ± 1%  3.565n ± 0%  -0.57% (p=0.000 n=20)
BM_new_sized_delete/64           4.559n ± 0%  4.544n ± 2%       ~ (p=0.298 n=20)
BM_size_returning_new_delete/8   3.814n ± 0%  3.741n ± 1%  -1.91% (p=0.000 n=20)
BM_size_returning_new_delete/64  3.840n ± 1%  3.761n ± 1%  -2.04% (p=0.000 n=20)
BM_aligned_new/8/8               5.440n ± 1%  5.434n ± 1%       ~ (p=0.255 n=20)
BM_aligned_new/64/64             5.929n ± 2%  5.462n ± 0%  -7.88% (p=0.000 n=20)

Without -fpie:
                                │    sec/op   │  sec/op    vs base             │
BM_new_delete/8                  9.216n ±  0%  8.785n ± 0% -4.68% (p=0.000 n=20)
BM_new_delete/64                 9.236n ±  0%  8.811n ± 0% -4.60% (p=0.000 n=20)
BM_new_sized_delete/8            4.454n ± 13%  4.419n ± 1%      ~ (p=0.071 n=20)
BM_new_sized_delete/64           4.465n ±  0%  4.468n ± 0%      ~ (p=0.846 n=20)
BM_size_returning_new_delete/8   4.438n ±  0%  4.416n ± 2%      ~ (p=0.057 n=20)
BM_size_returning_new_delete/64  4.489n ±  2%  4.892n ± 5%      ~ (p=0.107 n=20)
BM_aligned_new/8/8               4.625n ±  0%  4.623n ± 0%      ~ (p=0.587 n=20)
BM_aligned_new/64/64             6.365n ±  0%  6.472n ± 9%      ~ (p=0.080 n=20)

PiperOrigin-RevId: 617565606
Change-Id: I4291813fe540e6c0cecfb30c8893950c33c21dae
2024-03-20 10:57:36 -07:00
Dmitry Vyukov 9585806876 4-byte slab headers.
Currently the slab header is 8 bytes and holds [begin, current, end] indices.
This change switches to the new scheme where the header is 4 bytes and
holds only [current, end] indices. Begin indices are stored in a separate array
and are used only in slower operations.

In the new scheme we mark the stub element stored before the size class range
(the one that we use for prefetching when we pop the last element) with
low bit set.

PiperOrigin-RevId: 609982618
Change-Id: I7cff2c196c6a52f5fb7b08f1548c3e72a5ae2ad9
2024-02-24 04:57:30 -08:00
Dmitry Vyukov 99043c72a5 4-byte slab headers.
Currently the slab header is 8 bytes and holds [begin, current, end] indices.
This change switches to the new scheme where the header is 4 bytes and
holds only [current, end] indices. Begin indices are stored in a separate array
and are used only in slower operations.

In the new scheme we mark the stub element stored before the size class range
(the one that we use for prefetching when we pop the last element) with
low bit set. This allows to easily understand when we reached the begin
of the range during pop.

Currently Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 8), %[current]
      cmpw 2(%[scratch], %[size_class], 8), %w[current]
      jbe %l[underflow_path]
      movq -8(%[scratch], %[current], 8), %[result]

In the new scheme Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 4), %[current]
      movq -8(%[scratch], %[current], 8), %[result]
      testb $1, %b[result]
      jnz %l[underflow_path]

Effectively we trade:
  5167ca: 66 45 3b 4c d0 02            	cmpw	0x2(%r8,%rdx,8), %r9w
for:
  516654: a8 01                        	testb	$0x1, %al

This has several advantages: -1 load, -4 instruction bytes, but more importantly
fewer hot cache lines in L1D$ (~5 instead of 10).

Note: this required to move TcmallocSlab initialization a bit earlier in CpuCache,
so that we don't try to pop from uninitialized slab.

Microbenchmark results with -no-pie:
                                │   sec/op   │  sec/op     vs base             │
BM_new_delete/8                  9.091n ± 0%  8.851n ± 0%  -2.65% (p=0.000 n=20)
BM_new_delete/64                 9.111n ± 0%  8.873n ± 0%  -2.62% (p=0.000 n=20)
BM_new_sized_delete/8            3.585n ± 1%  3.565n ± 0%  -0.57% (p=0.000 n=20)
BM_new_sized_delete/64           4.559n ± 0%  4.544n ± 2%       ~ (p=0.298 n=20)
BM_size_returning_new_delete/8   3.814n ± 0%  3.741n ± 1%  -1.91% (p=0.000 n=20)
BM_size_returning_new_delete/64  3.840n ± 1%  3.761n ± 1%  -2.04% (p=0.000 n=20)
BM_aligned_new/8/8               5.440n ± 1%  5.434n ± 1%       ~ (p=0.255 n=20)
BM_aligned_new/64/64             5.929n ± 2%  5.462n ± 0%  -7.88% (p=0.000 n=20)

Without -fpie:
                                │    sec/op   │  sec/op    vs base             │
BM_new_delete/8                  9.216n ±  0%  8.785n ± 0% -4.68% (p=0.000 n=20)
BM_new_delete/64                 9.236n ±  0%  8.811n ± 0% -4.60% (p=0.000 n=20)
BM_new_sized_delete/8            4.454n ± 13%  4.419n ± 1%      ~ (p=0.071 n=20)
BM_new_sized_delete/64           4.465n ±  0%  4.468n ± 0%      ~ (p=0.846 n=20)
BM_size_returning_new_delete/8   4.438n ±  0%  4.416n ± 2%      ~ (p=0.057 n=20)
BM_size_returning_new_delete/64  4.489n ±  2%  4.892n ± 5%      ~ (p=0.107 n=20)
BM_aligned_new/8/8               4.625n ±  0%  4.623n ± 0%      ~ (p=0.587 n=20)
BM_aligned_new/64/64             6.365n ±  0%  6.472n ± 9%      ~ (p=0.080 n=20)

PiperOrigin-RevId: 608636032
Change-Id: I78547cf4535c84a0be2b3345bcff5e800ba6d1f6
2024-02-20 09:35:25 -08:00
Dmitry Vyukov d34eb1fa3c Revert: 4-byte slab headers.
Currently the slab header is 8 bytes and holds [begin, current, end] indices.
This change switches to the new scheme where the header is 4 bytes and
holds only [current, end] indices. Begin indices are stored in a separate array
and are used only in slower operations.

In the new scheme we mark the stub element stored before the size class range
(the one that we use for prefetching when we pop the last element) with
low bit set. T

PiperOrigin-RevId: 604897488
Change-Id: I6e5ee68239c3784fe388b9973c00b10b23d8bb43
2024-02-07 01:05:18 -08:00
Dmitry Vyukov b4316a2678 4-byte slab headers.
Currently the slab header is 8 bytes and holds [begin, current, end] indices.
This change switches to the new scheme where the header is 4 bytes and
holds only [current, end] indices. Begin indices are stored in a separate array
and are used only in slower operations.

In the new scheme we mark the stub element stored before the size class range
(the one that we use for prefetching when we pop the last element) with
low bit set. This allows to easily understand when we reached the begin
of the range during pop.

Currently Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 8), %[current]
      cmpw 2(%[scratch], %[size_class], 8), %w[current]
      jbe %l[underflow_path]
      movq -8(%[scratch], %[current], 8), %[result]

In the new scheme Pop check looks as follows:

      movzwq (%[scratch], %[size_class], 4), %[current]
      movq -8(%[scratch], %[current], 8), %[result]
      testb $1, %b[result]
      jnz %l[underflow_path]

Effectively we trade:
  5167ca: 66 45 3b 4c d0 02            	cmpw	0x2(%r8,%rdx,8), %r9w
for:
  516654: a8 01                        	testb	$0x1, %al

This has several advantages: -1 load, -4 instruction bytes, but more importantly
fewer hot cache lines in L1D$ (~5 instead of 10).

Note: this required to move TcmallocSlab initialization a bit earlier in CpuCache,
so that we don't try to pop from uninitialized slab.

Microbenchmark results with -no-pie:
                                │   sec/op   │  sec/op     vs base             │
BM_new_delete/8                  9.091n ± 0%  8.851n ± 0%  -2.65% (p=0.000 n=20)
BM_new_delete/64                 9.111n ± 0%  8.873n ± 0%  -2.62% (p=0.000 n=20)
BM_new_sized_delete/8            3.585n ± 1%  3.565n ± 0%  -0.57% (p=0.000 n=20)
BM_new_sized_delete/64           4.559n ± 0%  4.544n ± 2%       ~ (p=0.298 n=20)
BM_size_returning_new_delete/8   3.814n ± 0%  3.741n ± 1%  -1.91% (p=0.000 n=20)
BM_size_returning_new_delete/64  3.840n ± 1%  3.761n ± 1%  -2.04% (p=0.000 n=20)
BM_aligned_new/8/8               5.440n ± 1%  5.434n ± 1%       ~ (p=0.255 n=20)
BM_aligned_new/64/64             5.929n ± 2%  5.462n ± 0%  -7.88% (p=0.000 n=20)

Without -fpie:
                                │    sec/op   │  sec/op    vs base             │
BM_new_delete/8                  9.216n ±  0%  8.785n ± 0% -4.68% (p=0.000 n=20)
BM_new_delete/64                 9.236n ±  0%  8.811n ± 0% -4.60% (p=0.000 n=20)
BM_new_sized_delete/8            4.454n ± 13%  4.419n ± 1%      ~ (p=0.071 n=20)
BM_new_sized_delete/64           4.465n ±  0%  4.468n ± 0%      ~ (p=0.846 n=20)
BM_size_returning_new_delete/8   4.438n ±  0%  4.416n ± 2%      ~ (p=0.057 n=20)
BM_size_returning_new_delete/64  4.489n ±  2%  4.892n ± 5%      ~ (p=0.107 n=20)
BM_aligned_new/8/8               4.625n ±  0%  4.623n ± 0%      ~ (p=0.587 n=20)
BM_aligned_new/64/64             6.365n ±  0%  6.472n ± 9%      ~ (p=0.080 n=20)

PiperOrigin-RevId: 604575758
Change-Id: I79d1d556f2308536d92e944d303bb6c8c105f80a
2024-02-06 02:01:14 -08:00
Qian Ge f11e03405c Enable short-term long-term skip-subrelease feature, by setting its default intervals to non-zero values.
PiperOrigin-RevId: 603518027
Change-Id: I1df17a10169215f9da2d523568643fb413e14381
2024-02-01 16:39:51 -08:00
Dmitry Vyukov abcdeeac6b Simplify TcmallocSlab remote operations.
Currently we have 2 mechanisms to synchronize remote operations:
1. Coarse-gained used by Resize (sets resizing_ to prevent slab caching).
2. Fine-gained used by all other operations (uses complex header locking).

Switch all operations to the coarse-grained scheme.
Besides removing a chunk of the most complex and tricky code,
this reduces number of fences we need per remote operation
(now it's always 1 in the beginning, and no fences at the end),
and also unlocks other nice things in future changes:
 - combining fences for series of remote grow/shrink operations
 - arbitrary changes to the slab Header (now it can be any number
   of bytes changed in any way)

PiperOrigin-RevId: 603321290
Change-Id: Ib69d220fcd1d6188dabecbc023bc103339d96732
2024-02-01 03:40:08 -08:00
TCMalloc Team 229908285e Fix typo in "HugeCache" section
PiperOrigin-RevId: 568569943
Change-Id: Ib6033fce01c20dee11d7e5271686df4fe4529c0a
2023-09-26 09:54:32 -07:00
Patrick Xia 0ff2705779 docs-only: detailed sampling appendix
PiperOrigin-RevId: 563456028
Change-Id: Ic27880cacd26a6c3f6fc6b582c5db87c227da777
2023-09-07 09:30:00 -07:00
Patrick Xia 78b52c24d3 docs: add more detail about sampling
PiperOrigin-RevId: 555949021
Change-Id: Ic8cb135872f2c360d6dfa02a7d2e5e353a6765b6
2023-08-11 07:44:41 -07:00
Vaibhav Gogte 1c24af1cd9 Heterogeneous per-cpu caches have been enabled by default for a while now. Cleaning up the associated flag.
PiperOrigin-RevId: 547929754
Change-Id: I75e299192d2baf671aaece87ec02193f9745e346
2023-07-13 14:51:43 -07:00
Vaibhav Gogte c2bed55b0f Add documentation for hot_cold interface for new operator.
PiperOrigin-RevId: 543489075
Change-Id: Ie168f6bdf3368e80d183c0fc9f9eb37e260692f3
2023-06-26 11:10:35 -07:00
Qian Ge 9356aa1acb Adding an experimental feature for calculating demand requirement when making skip subrelease decisions in HugePageFiller.
Introduced a pair of parameters, filler_skip_subrelease_short_interval() and filler_skip_subrelease_long_interval(), for calculating the recent demand requirement. The former finds the recent short-term demand fluctuation peak and the latter finds the recent long-term demand trend. The feature is enabled by configuring either one of the two intervals. The demand requirement is the sum of the two (fluctuation peak and demand trend) if both are configured.

Note, we recommend configuring both intervals, and the short-interval should be (significantly) shorter or equal to the long-interval to avoid realized fragmentation caused by non-recent (short-term) demand spikes.

The feature is not enabled by default: HugePageFiller prefers to use recent demand peak for making skip-subrelease decisions if the existing parameter filler_skip_subrelease_interval() is configured.

PiperOrigin-RevId: 509328699
Change-Id: I734c1f5bd7b8352fadd0fc739cd144e969a4adc3
2023-02-13 14:10:44 -08:00
Chris Kennelly 147b61cffd Update docs.
PiperOrigin-RevId: 495589790
Change-Id: I3cfcefb8720e4c949c41e151433f657f6dfe4dfe
2022-12-15 07:39:37 -08:00
TCMalloc Team b135329211 Update documentation.
PiperOrigin-RevId: 490779135
Change-Id: Ibeb1b927e3a7772f0f88a80c9c3f02448c1326c3
2022-11-24 14:04:38 -08:00
Chris Kennelly 6a66f1080c Delete empirical driver in favor of https://github.com/google/fleetbench/tree/main/fleetbench/tcmalloc
PiperOrigin-RevId: 482268436
Change-Id: I7311ebeb2223c6d2239bea0ed2caebfe25b9e5b5
2022-10-19 12:08:15 -07:00
Snehasish Kumar 4d048a45a7 Release the lifetime (deallocation) profiler.
Lifetime profiling reports a list of object lifetimes as pairs of allocation and deallocation records. Profiling is initiated by calling MallocExtension::StartLifetimeProfiling(). Profiling continues until `Stop` is invoked on the token. Lifetimes are only reported for objects where allocation *and* deallocation are observed while profiling is active.

The design and prototype of the deallocation oriented, lifetime profiler came out of an internship by Mohammad Mahdi Javanmard. Martin Maas brought the prototype to production where it has been used since mid-2019.

PiperOrigin-RevId: 477807613
Change-Id: I36a35a4e5ef4e90aec6c83940f28b0ae45909ee4
2022-09-29 13:28:31 -07:00
Qian Ge 30b53b78cb Using a fixed time interval for evaluating the correctness of skipped subreleases. The fixed interval is shared with realized fragmentation evaluation.
PiperOrigin-RevId: 470020663
Change-Id: I1f3d1a923894a2a4fbffb7139e5c75ef3961ea57
2022-08-25 10:17:54 -07:00
Chris Kennelly 52a7eb942a Update last reviewed comment.
PiperOrigin-RevId: 454632561
Change-Id: Ia94b79df4376f3a4ed1f47324ae2ca3a00dda9ab
2022-06-13 09:51:26 -07:00
Vaibhav Gogte ba40bb90b7 Telemetry for reporting transfer cache occupancy.
This reports the number of objects currently occupied by the freelists in the transfer cache. It also reports the current capacity of the freelists, and the maximum capacity that they can grow to. We also make CapacityNeeded in RingBufferTransferCache public as it is called in the tests.

PiperOrigin-RevId: 449242106
Change-Id: I1584f1f9fbcb9f5a3800d800bc37531a75964faf
2022-05-17 09:37:39 -07:00
cuishuang 4ebaad71c4 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-24 23:38:56 +08:00
Chris Kennelly e10baddba3 Snapshot high water mark data for computing realized fragmentation.
This approximates "Adaptive Huge-Page Subrelease for Non-moving Memory
Allocators in Warehouse-Scale Computers"'s estimate of realized fragmentation
as T_{schedule} -> infinity.  It captures memory going unused at a peak in
OS-visible demand due to metadata requirements and binpacking losses.

PiperOrigin-RevId: 439611199
Change-Id: Iccc056d7439a0ccaa0e9b92df615f000b8d84ed6
2022-04-05 10:10:27 -07:00
Evan Brown da6613ae8e Update mallocz to print per-cpu cache miss ratios (overflows / underflows) and also total miss/reclaim stats over all CPUs.
Motivation: we're considering using these ratios in the slab resizing decision.
PiperOrigin-RevId: 427761329
Change-Id: Ia8e8a71df511a22d233ab07f316b5371fe8fa0d8
2022-02-10 08:56:04 -08:00