* MemoryContextContainsGenericAllocation * * Detects whether a generic (may or may not be allocated by palloc) chunk of * memory belongs to a given context or not. Note, the "generic" means it will * be ready to handle chunks not allocated using palloc, not at the start of an * allocated region, and not necessarily aligned. * * Currently only supports AllocSet, will error out if called on
| 973 | * performance implications before proceeding is recommended. |
| 974 | */ |
| 975 | bool |
| 976 | MemoryContextContainsGenericAllocation(MemoryContext context, void *pointer) |
| 977 | { |
| 978 | if (context->type != T_AllocSetContext) |
| 979 | MemoryContextError(ERRCODE_INTERNAL_ERROR, |
| 980 | context, CDB_MCXT_WHERE(context), |
| 981 | "MemoryContextContainsGenericAllocation is not available for type %u", |
| 982 | context->type); |
| 983 | |
| 984 | return AllocSetContains(context, pointer); |
| 985 | } |
| 986 | |
| 987 | /*-------------------- |
| 988 | * MemoryContextCreate |