vm-stats pages free vs free memory

I’m shelling out to get free memory and trying to use vm_stat and from there i get

Pages free: 146265

there 4096 bytes per page so:

bytes = 146265 * 4096 = 599101440
GB Free = 599101440/(102410241024) = 0.56GB

but in Activity monitor
total = 32GB
used = 28.37GB
So Free should be:
Free = 32-28.27 = 3.73GB

Why the huge difference? … Am I determining free memory from vm_stat correctly?
(and no I don’t have an MBS license - even if I did I would not want to use it for this project )

Thanks,

  • karen

As I recall, Activity Viewer includes memory that can be freed if necessary in their calculations.