Specialize MemoryContextMemAllocated().
authorJeff Davis <jdavis@postgresql.org>
Wed, 18 Mar 2020 22:39:14 +0000 (15:39 -0700)
committerJeff Davis <jdavis@postgresql.org>
Wed, 18 Mar 2020 22:39:14 +0000 (15:39 -0700)
commite00912e11a9ec2d29274ed8a6465e81385906dc2
tree3a8cfa1201e76fe7e6129a86243abef6ca386c64
parent487e9861d0cf83e9100ad0d0369147db3ef4ea73
Specialize MemoryContextMemAllocated().

An AllocSet doubles the size of allocated blocks (up to maxBlockSize),
which means that the current block can represent half of the total
allocated space for the memory context. But the free space in the
current block may never have been touched, so don't count the
untouched memory as allocated for the purposes of
MemoryContextMemAllocated().

Discussion: https://postgr.es/m/ec63d70b668818255486a83ffadc3aec492c1f57.camel@j-davis.com
src/backend/utils/mmgr/aset.c
src/backend/utils/mmgr/generation.c
src/backend/utils/mmgr/mcxt.c
src/backend/utils/mmgr/slab.c
src/include/nodes/memnodes.h