In the command line, i can use vmmap -v -purge 50554
to find the memory information of the process 50554, and get the output like below:
The answer to your question is somewhat complex, but can be found in the kernel source code for mach_vm_region_info(): https://opensource.apple.com/source/xnu/xnu-201/osfmk/vm/vm_debug.c
This code (among other things) runs through the VM map table and builds a linked list of structures which contain all of the info displayed by the vmmap(1) command.