Merge pull request #8815 from rdoeffinger/memlimit
Change memoryLimitation variable to long.
This commit is contained in:
commit
192427e37a
3 changed files with 9 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
|
||||
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<RoutingSubregionTile> list = new ArrayList<RoutingSubregionTile>(subregionTiles.size() / 2);
|
||||
int loaded = 0;
|
||||
|
@ -805,4 +805,4 @@ public class RoutingContext {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue