[postgis-tickets] r15354 - Clear hash tables after usage
bjorn at wololo.org
bjorn at wololo.org
Wed Apr 19 10:43:19 PDT 2017
Author: bjornharrtell
Date: 2017-04-19 10:43:18 -0700 (Wed, 19 Apr 2017)
New Revision: 15354
Modified:
trunk/postgis/mvt.c
trunk/postgis/mvt.h
Log:
Clear hash tables after usage
Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c 2017-04-12 13:36:21 UTC (rev 15353)
+++ trunk/postgis/mvt.c 2017-04-19 17:43:18 UTC (rev 15354)
@@ -190,7 +190,7 @@
c += 2 + lwmline->geoms[i]->points->npoints * 2;
feature->geometry = palloc(sizeof(*feature->geometry) * c);
for (i = 0; i < lwmline->ngeoms; i++)
- offset += encode_ptarray(ctx, MVT_LINE,
+ offset += encode_ptarray(ctx, MVT_LINE,
lwmline->geoms[i]->points,
feature->geometry + offset, &px, &py);
feature->n_geometry = offset;
@@ -328,6 +328,13 @@
ctx->layer->n_values = ctx->values_hash_i;
ctx->layer->values = values;
+
+ HASH_CLEAR(hh, ctx->string_values_hash);
+ HASH_CLEAR(hh, ctx->float_values_hash);
+ HASH_CLEAR(hh, ctx->double_values_hash);
+ HASH_CLEAR(hh, ctx->uint_values_hash);
+ HASH_CLEAR(hh, ctx->sint_values_hash);
+ HASH_CLEAR(hh, ctx->bool_values_hash);
}
#define MVT_PARSE_VALUE(value, kvtype, hash, valuefield, size) \
@@ -463,7 +470,7 @@
* Makes best effort to keep validity. Might collapse geometry into lower
* dimension.
*/
-LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer,
+LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer,
bool clip_geom)
{
double width = gbox->xmax - gbox->xmin;
@@ -533,7 +540,7 @@
/**
* Initialize aggregation context.
*/
-void mvt_agg_init_context(struct mvt_agg_context *ctx)
+void mvt_agg_init_context(struct mvt_agg_context *ctx)
{
VectorTile__Tile__Layer *layer;
@@ -544,7 +551,6 @@
ctx->string_values_hash = NULL;
ctx->float_values_hash = NULL;
ctx->double_values_hash = NULL;
- ctx->int_values_hash = NULL;
ctx->uint_values_hash = NULL;
ctx->sint_values_hash = NULL;
ctx->bool_values_hash = NULL;
@@ -628,4 +634,4 @@
return buf;
}
-#endif
\ No newline at end of file
+#endif
Modified: trunk/postgis/mvt.h
===================================================================
--- trunk/postgis/mvt.h 2017-04-12 13:36:21 UTC (rev 15353)
+++ trunk/postgis/mvt.h 2017-04-19 17:43:18 UTC (rev 15354)
@@ -31,7 +31,7 @@
#include "utils/array.h"
#include "utils/typcache.h"
#include "utils/lsyscache.h"
-#include "catalog/pg_type.h"
+#include "catalog/pg_type.h"
#include "executor/executor.h"
#include "access/htup_details.h"
#include "access/htup.h"
@@ -57,7 +57,6 @@
struct mvt_kv_string_value *string_values_hash;
struct mvt_kv_float_value *float_values_hash;
struct mvt_kv_double_value *double_values_hash;
- struct mvt_kv_int_value *int_values_hash;
struct mvt_kv_uint_value *uint_values_hash;
struct mvt_kv_sint_value *sint_values_hash;
struct mvt_kv_bool_value *bool_values_hash;
@@ -72,4 +71,4 @@
#endif /* HAVE_LIBPROTOBUF */
-#endif
\ No newline at end of file
+#endif
More information about the postgis-tickets
mailing list