a5d42e58d7f8ce1e985cf7422145619122ca5d25 braney Sat Sep 19 18:16:16 2026 -0700 mallocTopPadTester: check the heap step setting still reaches the library cfgSetMallocTopPad() asks glibc to grow the heap in steps of mallocTopPad bytes instead of its 128 kB default, which saves a heavy hgTracks render more than a hundred thousand system calls that draw nothing. The failure to catch is backsliding: the mallopt call is dropped in a later edit, or the setting is renamed, or it stops being read before the first allocation. Every page still draws correctly and the only symptom is that renders are slower than they used to be, which nobody attributes to this. So the test measures the step, not the clock. A timing test here would be red on a busy hgwdev, green on an idle one, and deleted within a month. sbrk(0) says where the heap ends and the distance it jumps when malloc extends it is what M_TOP_PAD sets, so the answer is the same on a loaded machine as an idle one. It is read in buckets, since glibc may round and may change what it rounds to; what must not change is the order of magnitude between a configured step and the default. Allocations stay under the mmap threshold, or the break never moves and the test measures nothing while appearing to pass. Two runs, with the setting and without, because the answer is the difference between them: a single run would pass on a library whose own default happened to be large. Watched to fail and then pass: leaving the knob read but never applied gives the default step under both confs, which is the one line the diff shows. Recorded as sandbox-ab in utils/testRegistry. refs #38225, refs #38391 diff --git src/hg/lib/tests/expected/mallocTopPadTest src/hg/lib/tests/expected/mallocTopPadTest new file mode 100644 index 00000000000..2b489874b5c --- /dev/null +++ src/hg/lib/tests/expected/mallocTopPadTest @@ -0,0 +1,4 @@ +mallocTopPad in hg.conf: (not set) +first heap growth: under 4 MB, the library's own default step +mallocTopPad in hg.conf: 33554432 +first heap growth: 16 MB or more, a configured step