Use explicit memory context with hash_create

This changes the hash_create calls in the function cache and in the
cagg code to use explicit memory context. Without this hash_create
will create the hash table in TopMemoryContext potentially leading
to memory leaks.
This commit is contained in:
Sven Klemm 2022-07-20 23:13:10 +02:00 committed by Sven Klemm
parent 4ed116b6f6
commit 7c841b8d92
2 changed files with 5 additions and 2 deletions

View File

@ -464,7 +464,10 @@ initialize_func_info()
Relation rel;
int i;
func_hash = hash_create("func_cache", _MAX_CACHE_FUNCTIONS, &hashctl, HASH_ELEM | HASH_BLOBS);
func_hash = hash_create("func_cache",
_MAX_CACHE_FUNCTIONS,
&hashctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
rel = table_open(ProcedureRelationId, AccessShareLock);

View File

@ -103,7 +103,7 @@ cache_inval_init()
continuous_aggs_cache_inval_htab = hash_create("TS Continuous Aggs Cache Inval",
CA_CACHE_INVAL_INIT_HTAB_SIZE,
&ctl,
HASH_ELEM | HASH_BLOBS);
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
};
static int64