[SCM] PostGIS branch master updated. 3.5.0-47-ge47945101

git at osgeo.org git at osgeo.org
Thu Nov 7 10:21:26 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  e479451016affe87eec1b6033184246a61d18276 (commit)
      from  474a54dc4e32741ecb88c5fa93692ad1ef447675 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e479451016affe87eec1b6033184246a61d18276
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Nov 7 19:21:03 2024 +0100

    Reduce use of TopMemoryContext
    
    References #5808

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index d8b4782a8..188b052dc 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -15,7 +15,7 @@
 #include "c.h" /* for UINT64_FORMAT and uint64 */
 #include "utils/builtins.h" /* for cstring_to_text */
 #include "utils/elog.h"
-#include "utils/memutils.h" /* for TopMemoryContext */
+#include "utils/memutils.h" /* for transaction contexts */
 #include "utils/array.h" /* for ArrayType */
 #include "catalog/pg_type.h" /* for INT4OID, TEXTOID */
 #include "lib/stringinfo.h"
@@ -793,12 +793,9 @@ fillEdgeFields(LWT_ISO_EDGE* edge, HeapTuple row, TupleDesc rowdesc, int fields)
     if ( ! isnull )
     {
       {
-        MemoryContext oldcontext = CurrentMemoryContext;
         geom = (GSERIALIZED *)PG_DETOAST_DATUM(dat);
         lwg = lwgeom_from_gserialized(geom);
-        MemoryContextSwitchTo( TopMemoryContext );
         edge->geom = lwgeom_as_lwline(lwgeom_clone_deep(lwg));
-        MemoryContextSwitchTo( oldcontext ); /* switch back */
         lwgeom_free(lwg);
         if ( DatumGetPointer(dat) != (Pointer)geom ) pfree(geom); /* IF_COPY */
       }
@@ -4106,8 +4103,8 @@ Datum ST_GetFaceGeometry(PG_FUNCTION_ARGS)
   }
 
   /* Serialize in upper memory context (outside of SPI) */
-  /* TODO: use a narrower context to switch to */
-  old_context = MemoryContextSwitchTo( TopMemoryContext );
+  /* TODO: use a narrower context to switch to ? */
+  old_context = MemoryContextSwitchTo( TopTransactionContext );
   geom = geometry_serialize(lwgeom);
   MemoryContextSwitchTo(old_context);
 

-----------------------------------------------------------------------

Summary of changes:
 topology/postgis_topology.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list