I'd like to add memory profiler to my daemon which runs under macOS. In linux, i could simply check the /proc/<pid>/map
for any mapped memory in the process, and look for pathname = [heap] or pathname = [stack].
Is there any alternative mac syscall/MIG/mach message for that purpose ?
I've tried to see if proc_pidinfo
contain any valuable information, but unfortunately nothing related to my needs.
Notice that apple provide such tool for other remote processes called vmmap
and it doesn't provide any api at all (it's merely command-line tool) and there's no public API for this demand, but perhaps there's an API to extract this information from "within" the process itself.