hi. +static void checkAllocations(); should be "static void checkAllocations(void);" ?
PgStatShared_Memtrack there is a lock, but seems not initialized, and not used. Can you expand on it? So in view pg_stat_global_memory_tracking, column "total_memory_reserved" is a point of time, total memory the whole server reserved/malloced? will it change every time you call it? the function pg_stat_get_global_memory_tracking provolatile => 's'. should be a VOLATILE function? pg_stat_get_memory_reservation, pg_stat_get_global_memory_tracking should be proretset => 'f'. +{ oid => '9891', + descr => 'statistics: memory utilized by current backend', + proname => 'pg_get_backend_memory_allocation', prorows => '1', proisstrict => 'f', + proretset => 't', provolatile => 's', proparallel => 'r', you declared +void pgstat_backend_memory_reservation_cb(void); but seems there is no definition. this part is unnecessary since you already declared src/include/catalog/pg_proc.dat? +/* SQL Callable functions */ +extern Datum pg_stat_get_memory_reservation(PG_FUNCTION_ARGS); +extern Datum pg_get_backend_memory_allocation(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_global_memory_tracking(PG_FUNCTION_ARGS); The last sentence is just a plain link, no explanation. something is missing? <para> + Reports how much memory remains available to the server. If a + backend process attempts to allocate more memory than remains, + the process will fail with an out of memory error, resulting in + cancellation of the process's active query/transaction. + If memory is not being limited (ie. max_total_memory is zero or not set), + this column returns NULL. + <xref linkend="guc-max-total-memory"/>. + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>static_shared_memory</structfield> <type>bigint</type> + </para> + <para> + Reports how much static shared memory (non-DSM shared memory) is being used by + the server. Static shared memory is configured by the postmaster at + at server startup. + <xref linkend="guc-max-total-memory"/>. + </para></entry> + </row>