[GraphHopper] Memory problem

Peter K peathal at yahoo.de
Mon Dec 23 13:00:58 UTC 2013


On Android it is recommended to keep the default settings otherwise
there is indeed a chance to get OOM. But if it is only a small area like
a city there should be no memory issues.

Regards,
Peter.

> I think i was wrong, i'm calling 
>                 tmpHopp.disableCHShortcuts();
> so i guess i'm not using the CH !?!?
>
> I still didnt get the VisitedNodes, i found the class but i still
> didnt get access to create the log
>
>
> On Fri, Dec 20, 2013 at 3:11 PM, Bruno Marques <baamarques at gmail.com
> <mailto:baamarques at gmail.com>> wrote:
>
>     Yes, i'm using CH.
>     I will look for that info, the visitedNodes, I will post more info
>     when I get the logs
>
>     thanks
>
>
>     On Fri, Dec 20, 2013 at 1:18 PM, Peter K <peathal at yahoo.de
>     <mailto:peathal at yahoo.de>> wrote:
>
>         There is not enough memory to do the rehash of the internally
>         used HashMap. It could be that the Dalvik is not releasing it
>         fast enough (which could be slightly workarounded via reusing
>         the datastructures of Dijkstra).
>
>         Are you using CH? And can you log or find out somehow the
>         visitedNodes of the dijkstra algorithm?
>         dijkstraBidirectionRef.getVisitedNodes()
>
>         Regards,
>         Peter.
>
>>         I'm calculating several paths between a few points of
>>         interest, i think i'm having problems with leaking memory or
>>         somthing
>>         With the log, can you see if some problem with the gh? or if
>>         its some problem with my proj
>>
>>         12-20 11:03:24.669: E/dalvikvm-heap(10791): Out of memory on
>>         a 7830620-byte allocation.
>>         12-20 11:03:24.669: I/dalvikvm(10791): "AsyncTask #3" prio=5
>>         tid=15 RUNNABLE
>>         12-20 11:03:24.669: I/dalvikvm(10791):   | group="main"
>>         sCount=0 dsCount=0 obj=0x40774ff0 self=0x3ddfd8
>>         12-20 11:03:24.669: I/dalvikvm(10791):   | sysTid=10921
>>         nice=10 sched=3/0 cgrp=default handle=3422784
>>         12-20 11:03:24.669: I/dalvikvm(10791):   | schedstat=(
>>         34916079000 976208000 2523 )
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         gnu.trove.map.hash.TIntObjectHashMap.rehash(TIntObjectHashMap.java:~157)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         gnu.trove.impl.hash.THash.postInsertHook(THash.java:388)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         gnu.trove.map.hash.TIntObjectHashMap.doPut(TIntObjectHashMap.java:248)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         gnu.trove.map.hash.TIntObjectHashMap.put(TIntObjectHashMap.java:222)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.routing.DijkstraBidirectionRef.fillEdges(DijkstraBidirectionRef.java:160)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.routing.DijkstraBidirectionRef.fillEdgesFrom(DijkstraBidirectionRef.java:200)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.routing.DijkstraBidirectionRef.calcPath(DijkstraBidirectionRef.java:106)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.GraphHopper.route(GraphHopper.java:615)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.android.MainActivity$9.doInBackground(MainActivity.java:618)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         com.graphhopper.android.MainActivity$9.doInBackground(MainActivity.java:1)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         android.os.AsyncTask$2.call(AsyncTask.java:185)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
>>         12-20 11:03:24.669: I/dalvikvm(10791):   at
>>         java.lang.Thread.run(Thread.java:1019)
>>         12-20 11:03:24.669: W/dalvikvm(10791): threadid=15: thread
>>         exiting with uncaught exception (group=0x4001d560)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): FATAL EXCEPTION:
>>         AsyncTask #3
>>         12-20 11:03:24.679: E/AndroidRuntime(10791):
>>         java.lang.RuntimeException: An error occured while executing
>>         doInBackground()
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         android.os.AsyncTask$3.done(AsyncTask.java:200)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.FutureTask.setException(FutureTask.java:125)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.lang.Thread.run(Thread.java:1019)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): Caused by:
>>         java.lang.OutOfMemoryError
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         gnu.trove.map.hash.TIntObjectHashMap.rehash(TIntObjectHashMap.java:157)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         gnu.trove.impl.hash.THash.postInsertHook(THash.java:388)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         gnu.trove.map.hash.TIntObjectHashMap.doPut(TIntObjectHashMap.java:248)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         gnu.trove.map.hash.TIntObjectHashMap.put(TIntObjectHashMap.java:222)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.routing.DijkstraBidirectionRef.fillEdges(DijkstraBidirectionRef.java:160)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.routing.DijkstraBidirectionRef.fillEdgesFrom(DijkstraBidirectionRef.java:200)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.routing.DijkstraBidirectionRef.calcPath(DijkstraBidirectionRef.java:106)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.GraphHopper.route(GraphHopper.java:615)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.android.MainActivity$9.doInBackground(MainActivity.java:618)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         com.graphhopper.android.MainActivity$9.doInBackground(MainActivity.java:1)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         android.os.AsyncTask$2.call(AsyncTask.java:185)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): at
>>         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
>>         12-20 11:03:24.679: E/AndroidRuntime(10791): ... 4 more
>>         12-20 11:03:33.827: D/dalvikvm(10791): GC_EXPLICIT freed
>>         26435K, 89% free 3654K/32519K, external 4397K/5491K, paused 147ms
>>
>>
>>
>>         On Tue, Dec 17, 2013 at 10:47 PM, Ignas Kapoc(ius
>>         <kapocius.ignas at gmail.com <mailto:kapocius.ignas at gmail.com>>
>>         wrote:
>>
>>             What a fool of me - I somehow managed to mistaken folders
>>             while copying them and there were edges/geometry/etc
>>             files on my android device.
>>
>>             Sorry for all this spam and thank you for your help again!
>>
>>
>>
>>
>>
>>             ----------------------
>>
>>             Ignas Kapoc(ius
>>
>>
>>
>>             2013/12/17 Peter K <peathal at yahoo.de
>>             <mailto:peathal at yahoo.de>>
>>
>>                 without a log file or more info of how your code
>>                 looks like we probably won't be able to help you :)
>>
>>                 Regards,
>>                 Peter.
>>
>>>                 I'll look into that, thank you! 
>>>
>>>                 What about extracting routing data for a specific city? 
>>>                 I've tried using bbike
>>>                 http://download.bbbike.org/osm/ , extracted this:
>>>                  http://download.bbbike.org/osm/extract/planet_25.1591,54.6528_25.3957,54.752.osm.pbf (Vilnius
>>>                 city, Lithuania) and executed ./graphopper.sh import
>>>                 vilnius-city-latest.osm.pmf
>>>
>>>                 Then I've downloaded Lithuania map from
>>>                 here http://download.mapsforge.org/maps/europe/ ,
>>>                 created folder vilnius-city-latest-gh and pasted it
>>>                 into Android file system. 
>>>
>>>                 When I run app it displays a map but when I try
>>>                 calculate distance between two points (with your
>>>                 methods) app crashes. 
>>>
>>>                 Then i've tested it with australia map and it's
>>>                 routing data and it works. So I'm guessing I have
>>>                 some problems with routing data that I've got from
>>>                 bbbike and I've no idea how else to extract correct
>>>                 routing data. 
>>>
>>>                   
>>>
>>>                 ----------------------
>>>
>>>                 Ignas Kapoc(ius
>>>
>>>
>>>
>>>                 2013/12/17 Peter K <peathal at yahoo.de
>>>                 <mailto:peathal at yahoo.de>>
>>>
>>>                     Hi Ignas,
>>>
>>>                     have a look into the android/ folder. There you
>>>                     see how it work. And you can set the algorithm
>>>                     in the GHRequest object. If contraction
>>>                     hierarchy is enabled only bidirectional
>>>                     algorithms will work. The GHResponse contains
>>>                     all the necessary information like points and
>>>                     instructions.
>>>
>>>                     > Should I first make some kind of subgraph (due
>>>                     to efficiency)?
>>>
>>>                     There are several techniques to make it faster
>>>                     like CH, but you could also use more heuristical
>>>                     routing algorithms, sorting the graph, in-memory
>>>                     instead memory mapped etc
>>>
>>>                     Regards,
>>>                     Peter.
>>>
>>>>                     Hello, 
>>>>
>>>>                     I've got Graphhopper going on my Android device. 
>>>>
>>>>                     Now my goal is to select two points on the map,
>>>>                     apply one of the algorithms (Dijksta, A*, etc)
>>>>                     and display results with an overlay. 
>>>>
>>>>                     Due to lack of documentation & being a little
>>>>                     bit in a hurry, could somebody point me
>>>>                     where/how to start? 
>>>>
>>>>                     I understand the basics - getting point's
>>>>                     coordinates, displaying an overlay with
>>>>                     results. The part where I'm confused is how to
>>>>                     apply search algorithms in Graphhopper? 
>>>>
>>>>                     Should I first make some kind of subgraph (due
>>>>                     to efficiency)? 
>>>>                     How can I get all the points (on streets, i.e.)
>>>>                     between those two points?
>>>>                     Is there something like getStreet(point1,
>>>>                     point2) that gives you back most likely street
>>>>                     between your two points? 
>>>>
>>>>                     Pardon my naivety, but I'm new to mapping,
>>>>                     routing, etc & my BA thesis' handing in
>>>>                     deadline is coming really fast. ;) any help
>>>>                     appreciated!
>>>>                     ----------------------
>>>>
>>>>                     Ignas Kapoc(ius
>>>>
>>>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20131223/20a5ede9/attachment.html>


More information about the GraphHopper mailing list