If they allocate memory at all, they only allocatereserve it as space in swap.
mmap, malloc, and shmget reserveallocate space in the calling process’ address space; on Linux, mmap and shmget also allocatereserve space in swap space (unless MAP_NORESERVE or SHM_NORESERVE are specified). They don’t allocate backing physical memory. shm_open doesn’t allocate memory either: it’s used to open an existing object, or create a new 0-length object.
Memory isActual pages of memory are allocated when addresses in the address space are dereferenced. That allocation always happens in physical memory, if it’s possible at all; otherwise the process wouldn’t be able to read or write there. After it’s allocated, and written to, non-locked memory can be swapped out, but that happens later if at all.
(By “reserve”, I mean that the corresponding amount of storage is set aside for the process; by “allocate”, I mean that specific resources are assigned to the process, e.g. addresses in the virtual address space, or pages in memory.)