@@ -316,6 +316,9 @@ node_ram_cache::node_ram_cache(int strategy, int cacheSizeMB)
316316 cacheSize((int64_t )cacheSizeMB * 1024 * 1024), storedNodes(0 ), totalNodes(0 ),
317317 nodesCacheHits(0 ), nodesCacheLookups(0 ), warn_node_order(0 )
318318{
319+ if (cacheSize == 0 )
320+ return ;
321+
319322 blockCache = 0 ;
320323 blockCachePos = 0 ;
321324 /* How much we can fit, and make sure it's odd */
@@ -388,6 +391,9 @@ node_ram_cache::node_ram_cache(int strategy, int cacheSizeMB)
388391
389392node_ram_cache::~node_ram_cache ()
390393{
394+ if (cacheSize == 0 )
395+ return ;
396+
391397 fprintf (stderr, " node cache: stored: %" PRIdOSMID
392398 " (%.2f%%), storage efficiency: %.2f%% (dense blocks: %i, "
393399 " sparse nodes: %" PRId64 " ), hit rate: %.2f%%\n " ,
@@ -417,6 +423,9 @@ node_ram_cache::~node_ram_cache()
417423
418424void node_ram_cache::set (osmid_t id, const osmium::Location &coord)
419425{
426+ if (cacheSize == 0 )
427+ return ;
428+
420429 if ((id > 0 && id >> BLOCK_SHIFT >> 32 ) ||
421430 (id < 0 && ~id >> BLOCK_SHIFT >> 32 )) {
422431 fprintf (stderr, " \n Absolute node IDs must not be larger than %" PRId64
@@ -448,6 +457,9 @@ osmium::Location node_ram_cache::get(osmid_t id)
448457{
449458 osmium::Location coord;
450459
460+ if (cacheSize == 0 )
461+ return coord;
462+
451463 if (allocStrategy & ALLOC_DENSE) {
452464 coord = get_dense (id);
453465 }
0 commit comments