source: subversion/applications/utils/export/osm2pgsql/output.h @ 26708

Last change on this file since 26708 was 26665, checked in by apmon, 8 years ago

[osm2pgsql] allocate node cache in one big chunk instead of small pieces

This is a patch by Hartmut Holzgraefe ( ),
adapted to add a command-line switch to revert to the old behavior

Allocating the node cache in small chunks causes the memory not to be returned to the operating system after it is free()ed,
as it is using a different internal allocation strategy (not mmap based).

With the new (default) behavior the entire node cache is allocated in one single malloc call.

At least on Linux, physical memory is still only allocated in chunks when it is needed and only virtual memory is reserved in one chunk.
So apart from the correct freeing of memory during the indexing stage, behavior doesn't change.
Other operating systems might behave differently though, which is why the old strategy can still be selected via a command line switch.

File size: 3.1 KB
1/* Common output layer interface */
3/* Each output layer must provide methods for
4 * storing:
5 * - Nodes (Points of interest etc)
6 * - Way geometries
7 * Associated tags: name, type etc.
10#ifndef OUTPUT_H
11#define OUTPUT_H
13#include "middle.h"
14#include "keyvals.h"
16/* Variants for generation of hstore column */
17/* No hstore column */
18#define HSTORE_NONE 0
19/* create a hstore column for all tags which do not have an exclusive column */
20#define HSTORE_NORM 1
21/* create a hstore column for all tags */
22#define HSTORE_ALL 2
24struct output_options {
25  const char *conninfo;  /* Connection info string */
26  const char *prefix;    /* prefix for table names */
27  int scale;       /* scale for converting coordinates to fixed point */
28  int projection;  /* SRS of projection */
29  int append;      /* Append to existing data */
30  int slim;        /* In slim mode */
31  int cache;       /* Memory usable for cache in MB */
32  struct middle_t *mid;  /* Mid storage to use */
33  const char *tblsmain_index;     /* Pg Tablespace to store indexes on main tables */
34  const char *tblsslim_index;     /* Pg Tablespace to store indexes on slim tables */
35  const char *tblsmain_data;     /* Pg Tablespace to store main tables */
36  const char *tblsslim_data;     /* Pg Tablespace to store slim tables */
37  const char *style;     /* style file to use */
38  int expire_tiles_zoom;        /* Zoom level for tile expiry list */
39  int expire_tiles_zoom_min;    /* Minimum zoom level for tile expiry list */
40  const char *expire_tiles_filename;    /* File name to output expired tiles list to */
41  int enable_hstore; /* add an additional hstore column with objects key/value pairs */
42  int enable_multi; /* Output multi-geometries intead of several simple geometries */
43  const char** hstore_columns; /* list of columns that should be written into their own hstore column */
44  int n_hstore_columns; /* number of hstore columns */
45  int keep_coastlines;
46  int parallel_indexing;
47  int alloc_chunkwise;
50struct output_t {
51    int (*start)(const struct output_options *options);
52    void (*stop)();
53    void (*cleanup)(void);
54//    void (*process)(struct middle_t *mid);
55//    int (*node)(osmid_t id, struct keyval *tags, double node_lat, double node_lon);
56//    int (*way)(osmid_t id, struct keyval *tags, struct osmNode *nodes, int count);
57//    int (*relation)(osmid_t id, struct keyval *rel_tags, struct osmNode **nodes, struct keyval **tags, int *count);
59    int (*node_add)(osmid_t id, double lat, double lon, struct keyval *tags);
60    int (*way_add)(osmid_t id, osmid_t *nodes, int node_count, struct keyval *tags);
61    int (*relation_add)(osmid_t id, struct member *members, int member_count, struct keyval *tags);
63    int (*node_modify)(osmid_t id, double lat, double lon, struct keyval *tags);
64    int (*way_modify)(osmid_t id, osmid_t *nodes, int node_count, struct keyval *tags);
65    int (*relation_modify)(osmid_t id, struct member *members, int member_count, struct keyval *tags);
67    int (*node_delete)(osmid_t id);
68    int (*way_delete)(osmid_t id);
69    int (*relation_delete)(osmid_t id);
72unsigned int pgsql_filter_tags(enum OsmType type, struct keyval *tags, int *polygon);
Note: See TracBrowser for help on using the repository browser.