mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Unify src/common/'s definitions of MaxAllocSize.
As threatened in the previous patch, define MaxAllocSize in src/include/common/fe_memutils.h rather than having several copies of it in different src/common/*.c files. This also provides an opportunity to document it better. While this would probably be safe to back-patch, I'll refrain (for now anyway).
This commit is contained in:
@@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
/* It's possible we could use a different value for this in frontend code */
|
|
||||||
#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,10 +24,6 @@
|
|||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
#else
|
#else
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
/* It's possible we could use a different value for this in frontend code */
|
|
||||||
#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common/saslprep.h"
|
#include "common/saslprep.h"
|
||||||
|
@@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
/* It's possible we could use a different value for this in frontend code */
|
|
||||||
#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "lib/stringinfo.h"
|
#include "lib/stringinfo.h"
|
||||||
|
@@ -9,6 +9,18 @@
|
|||||||
#ifndef FE_MEMUTILS_H
|
#ifndef FE_MEMUTILS_H
|
||||||
#define FE_MEMUTILS_H
|
#define FE_MEMUTILS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assumed maximum size for allocation requests.
|
||||||
|
*
|
||||||
|
* We don't enforce this, so the actual maximum is the platform's SIZE_MAX.
|
||||||
|
* But it's useful to have it defined in frontend builds, so that common
|
||||||
|
* code can check for oversized requests without having frontend-vs-backend
|
||||||
|
* differences. Also, some code relies on MaxAllocSize being no more than
|
||||||
|
* INT_MAX/2, so rather than setting this to SIZE_MAX, make it the same as
|
||||||
|
* the backend's value.
|
||||||
|
*/
|
||||||
|
#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flags for pg_malloc_extended and palloc_extended, deliberately named
|
* Flags for pg_malloc_extended and palloc_extended, deliberately named
|
||||||
* the same as the backend flags.
|
* the same as the backend flags.
|
||||||
|
Reference in New Issue
Block a user