diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index f92a7a66d3..de2da50d79 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -119,7 +119,7 @@ public class BinaryRoutePlanner { printMemoryConsumption("Memory occupied before exception : "); } if (ctx.memoryOverhead > ctx.config.memoryLimitation * 0.95) { - throw new IllegalStateException("There is no enough memory " + ctx.config.memoryLimitation / (1 << 20) + " Mb"); + throw new IllegalStateException("There is not enough memory " + ctx.config.memoryLimitation / (1 << 20) + " Mb"); } ctx.visitedSegments ++; if (forwardSearch) { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java index 14f26123a5..232b971f9f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java @@ -29,7 +29,7 @@ public class RoutingConfiguration { // 1.1 tile load parameters (should not affect routing) public int ZOOM_TO_LOAD_TILES = 16; - public int memoryLimitation; + public long memoryLimitation; // 1.2 Build A* graph in backward/forward direction (can affect results) // 0 - 2 ways, 1 - direct way, -1 - reverse way @@ -98,12 +98,12 @@ public class RoutingConfiguration { i.ZOOM_TO_LOAD_TILES = parseSilentInt(getAttribute(i.router, "zoomToLoadTiles"), i.ZOOM_TO_LOAD_TILES); int desirable = parseSilentInt(getAttribute(i.router, "memoryLimitInMB"), 0); if(desirable != 0) { - i.memoryLimitation = desirable * (1 << 20); + i.memoryLimitation = desirable * (1l << 20); } else { if(memoryLimitMB == 0) { memoryLimitMB = DEFAULT_MEMORY_LIMIT; } - i.memoryLimitation = memoryLimitMB * (1 << 20); + i.memoryLimitation = memoryLimitMB * (1l << 20); } i.planRoadDirection = parseSilentInt(getAttribute(i.router, "planRoadDirection"), i.planRoadDirection); // i.planRoadDirection = 1; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java index c72c5657fa..77e08443db 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java @@ -265,7 +265,7 @@ public class RoutingContext { - public RouteSegment loadRouteSegment(int x31, int y31, int memoryLimit) { + public RouteSegment loadRouteSegment(int x31, int y31, long memoryLimit) { long tileId = getRoutingTile(x31, y31, memoryLimit); TLongObjectHashMap excludeDuplications = new TLongObjectHashMap(); RouteSegment original = null; @@ -443,7 +443,7 @@ public class RoutingContext { } @SuppressWarnings("unused") - private long getRoutingTile(int x31, int y31, int memoryLimit) { + private long getRoutingTile(int x31, int y31, long memoryLimit) { // long now = System.nanoTime(); long xloc = x31 >> (31 - config.ZOOM_TO_LOAD_TILES); long yloc = y31 >> (31 - config.ZOOM_TO_LOAD_TILES); @@ -515,11 +515,11 @@ public class RoutingContext { - public boolean checkIfMemoryLimitCritical(int memoryLimit) { + public boolean checkIfMemoryLimitCritical(long memoryLimit) { return getCurrentEstimatedSize() > 0.9 * memoryLimit; } - public void unloadUnusedTiles(int memoryLimit) { + public void unloadUnusedTiles(long memoryLimit) { float desirableSize = memoryLimit * 0.7f; List list = new ArrayList(subregionTiles.size() / 2); int loaded = 0; @@ -805,4 +805,4 @@ public class RoutingContext { -} \ No newline at end of file +}