Search code examples
iosmacoskernelmach

What's the difference between mach_vm_allocate and vm_allocate?


I would like to know what's the difference betweenmach_vm_allocate and vm_allocate. I know mach_vm_allocate is only available in OS X and not iOS, but I'm not sure why. The file that has all the function prototypes in for the mach_vm_... functions (mach/mach_vm.h) only has #error mach_vm.h unsupported. in iOS.


Solution

  • the new Mach VM API that is introduced in Mac OS X 10.4. The new API is essentially the same as the old API from the programmer's standpoint, with the following key differences.

    -Routine names have the mach_ prefixfor example, vm_allocate() becomes mach_vm_allocate() .

    -Data types used in routines have been updated to support both 64-bit and 32-bit tasks. Consequently, the new API can be used with any task.

    The new and old APIs are exported by different MIG subsystems: mach_vm and vm_map , respectively. The corresponding header files are <mach/mach_vm.h> and <mach/vm_map.h> , respectively.