File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ PyObject *PLy_interp_globals = NULL;
7373/* this doesn't need to be global; use PLy_current_execution_context() */
7474static PLyExecutionContext * PLy_execution_contexts = NULL ;
7575
76+ static MemoryContext PLy_memory_context ;
7677
7778void
7879_PG_init (void )
@@ -464,3 +465,14 @@ PLy_pop_execution_context(void)
464465 MemoryContextDelete (context -> scratch_ctx );
465466 pfree (context );
466467}
468+
469+ MemoryContext
470+ PLy_get_global_memory_context (void )
471+ {
472+ if (!PLy_memory_context )
473+ PLy_memory_context = AllocSetContextCreate (TopMemoryContext ,
474+ "PL/Python global context" ,
475+ ALLOCSET_DEFAULT_SIZES );
476+
477+ return PLy_memory_context ;
478+ }
Original file line number Diff line number Diff line change @@ -28,4 +28,7 @@ extern PLyExecutionContext *PLy_current_execution_context(void);
2828/* Get the scratch memory context for specified execution context */
2929extern MemoryContext PLy_get_scratch_context (PLyExecutionContext * context );
3030
31+ /* Get the global memory context */
32+ extern MemoryContext PLy_get_global_memory_context (void );
33+
3134#endif /* PLPY_MAIN_H */
You can’t perform that action at this time.
0 commit comments