Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b7d637

Browse files
author
Nikita Glukhov
committed
Add global memory context to PL/Python
1 parentff85306 commit4b7d637

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎src/pl/plpython/plpy_main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ PyObject *PLy_interp_globals = NULL;
7373
/* this doesn't need to be global; use PLy_current_execution_context() */
7474
staticPLyExecutionContext*PLy_execution_contexts=NULL;
7575

76+
staticMemoryContextPLy_memory_context;
7677

7778
void
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+
returnPLy_memory_context;
478+
}

‎src/pl/plpython/plpy_main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ extern PLyExecutionContext *PLy_current_execution_context(void);
2828
/* Get the scratch memory context for specified execution context */
2929
externMemoryContextPLy_get_scratch_context(PLyExecutionContext*context);
3030

31+
/* Get the global memory context */
32+
externMemoryContextPLy_get_global_memory_context(void);
33+
3134
#endif/* PLPY_MAIN_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp