Memory used does not add up on M1 mac in activity monitor

We are working on a tool that gives stats about the system such as total used memory. It looks at the output of vm_stat to get the app memory, wired memory and compressed memory to report on total memory used. This matches the value shown in activity monitor.

This works very well for older macs running on the intel processors. However on a newer mac running the M1 processor, the number obtained by adding the App Memory, Wired memory and compressed memory seems to be smaller than the Memory used field. Where is the remaining memory being used and can it be seen by looking at the vm_stat command?

Example numbers on Intel mac:

App memory: 9.92GB, Wired memory: 3.31GB, Compressed Memory: 2.22GB, Sum = 15.45GB

Memory Used: 15.47GB

Example numbers on M1 mac:

App memory: 4.21GB, Wired memory: 983.4MB, Compressed memory: 137.3 MB, Sum = 5.3GB

Memory Used: 5.88GB

Followup question - is there a better way to get used memory for the device?

Memory used does not add up on M1 mac in activity monitor
 
 
Q