mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Reduce tippecanoe memory usage (#5)
* Change JSON objects to a union type to use less memory * Stop storing the string representation of JSON numbers * Restore the ability to create features with large integer attributes * Make sure large-integer feature IDs still behave as before * Add missing #include * Don't preallocate as much space for arrays and objects * Treat inability to check free disk space as a warning, not an error * Update changelog and version
This commit is contained in:
+4
-4
@@ -191,14 +191,14 @@ sqlite3 *dirmeta2tmp(const char *fname) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < o->length; i++) {
|
||||
if (o->keys[i]->type != JSON_STRING || o->values[i]->type != JSON_STRING) {
|
||||
for (size_t i = 0; i < o->value.object.length; i++) {
|
||||
if (o->value.object.keys[i]->type != JSON_STRING || o->value.object.values[i]->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s: non-string in metadata\n", name.c_str());
|
||||
}
|
||||
|
||||
char *sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES (%Q, %Q);", o->keys[i]->string, o->values[i]->string);
|
||||
char *sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES (%Q, %Q);", o->value.object.keys[i]->value.string.string, o->value.object.values[i]->value.string.string);
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set %s in metadata: %s\n", o->keys[i]->string, err);
|
||||
fprintf(stderr, "set %s in metadata: %s\n", o->value.object.keys[i]->value.string.string, err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user