↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Documentation / Extension Hooks / Startup and shared memory

shmem_startup_hook

shmem_startup_hook

Now give loadable modules a chance to set up their shmem allocations

Reading PostgreSQL 18.

Description

Now give loadable modules a chance to set up their shmem allocations

Interface type
shmem_startup_hook_type
Header
src/include/storage/ipc.h
Subsystem
Startup and shared memory
Initial value
NULL (no hook installed)

C interface

typedef void (*shmem_startup_hook_type) (void);
extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook;

Call sites

src/backend/storage/ipc/ipci.c:191

src/backend/storage/ipc/ipci.c:249

Core call context: src/backend/storage/ipc/ipci.c:185–199

	CreateOrAttachShmemStructs();

	/*
	 * Now give loadable modules a chance to set up their shmem allocations
	 */
	if (shmem_startup_hook)
		shmem_startup_hook();
}
#endif

/*
 * CreateSharedMemoryAndSemaphores
 *		Creates and initializes shared memory and semaphores.
 */
void

Core call context: src/backend/storage/ipc/ipci.c:243–257

	dsm_postmaster_startup(shim);

	/*
	 * Now give loadable modules a chance to set up their shmem allocations
	 */
	if (shmem_startup_hook)
		shmem_startup_hook();
}

/*
 * Initialize various subsystems, setting up their data structures in
 * shared memory.
 *
 * This is called by the postmaster or by a standalone backend.
 * It is also called by a backend forked from the postmaster in the

Related entries

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Related entries

Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.