void CreateSharedMemoryAndSemaphores(void) { PGShmemHeader *shim = NULL; if (!IsUnderPostmaster) { Size size; size = 100000; size = add_size(size, PGSemaphoreShmemSize(numSemas)); size = add_size(size, SpinlockSemaSize()); size = add_size(size, hash_estimate_size(SHMEM_INDEX_SIZE, sizeof(ShmemIndexEnt))); size = add_size(size, dsm_estimate_size()); …… /* * Create the shmem segment */ seghdr = PGSharedMemoryCreate(size, &shim); } …… /* Initialize dynamic shared memory facilities. */ if (!IsUnderPostmaster) dsm_postmaster_startup(shim); }