Import OSM File Takes a Lot of RAM Usage

Hello, I was tried to download map from geofabric for Indonesia
All Indonesia Maps

The file size is around 1.5GB. When I .importAndClose, it takes a lot of RAM.
I used Glowroot for monitoring RAM Usage on my server

JVM Thread Stats (Main Thread)
CPU time: 433,900.1 milliseconds
Blocked time: 0.0 milliseconds
Waited time: 2,900,612.0 milliseconds
Allocated memory: 69.3 GB

JVM Thread Stats (Auxiliary Threads)
CPU time: 3,106,236.4 milliseconds
Blocked time: 149.0 milliseconds
Waited time: 274,667.0 milliseconds
Allocated memory: 402.3 GB

This is my code for extract the map

EncodingManager encodingManager = new EncodingManager.Builder()
		.add(new CarFlagEncoder())
		.add(new CarWaterFlagEncoder())
		.add(new WaterFlagEncoder())
		.add(new MotorcycleFlagEncoder())
		.add(new MotorcycleWaterFlagEncoder())
		.build();

GraphHopperOSM graphHopperOsm = new GraphHopperOSM();
graphHopperOsm.forServer();
graphHopperOsm.setDataReaderFile(dataReaderFile);
graphHopperOsm.setGraphHopperLocation(graphHopperLocation);
graphHopperOsm.setEncodingManager(encodingManager);
graphHopperOsm.getCHPreparationHandler().setDisablingAllowed(true);
graphHopperOsm.setProfiles(
	new Profile("car").setVehicle("car").setWeighting("shortest"), 
	new Profile("car_water").setVehicle("car_water").setWeighting("shortest"), 
	new Profile("water").setVehicle("water").setWeighting("shortest"), 
	new Profile("motorcycle").setVehicle("motorcycle").setWeighting("shortest"),
	new Profile("motorcycle_water").setVehicle("motorcycle_water").setWeighting("shortest")
);

graphHopperOsm.getCHPreparationHandler().setCHProfiles(
	new CHProfile("car"),
	new CHProfile("car_water"),
	new CHProfile("water"),
	new CHProfile("motorcycle"),
	new CHProfile("motorcycle_water")
);				


graphHopperOsm.importAndClose();

I used my custom class CHProfile for amphibian vehicle (Car_Water, Motorcycle_Water) and also Water

I use graphhopper reader OSM 1.0 for extract map.

<dependency>
	<groupId>com.graphhopper</groupId>
	<artifactId>graphhopper-reader-osm</artifactId>
	<version>1.0</version>
</dependency>

What should I do for decrease the RAM Usage ?

If you run GraphHopper the RAM usage is controlled via the -Xmx parameter. (see deployment guide)

GraphHopper will use the specified maximum amount and the JVM will use an additional amount of RAM (~10% but depends on the garbage collector)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.