[GraphHopper] Android: Unload graph

Peter K peathal at yahoo.de
Fri Apr 25 13:22:10 UTC 2014


Hey Emux,

on application finish you should call hopper.close();
Let me know if this helped and please create an issue/pull request if
that is not in the Android sample.

Regards,
Peter.

> Hi Peter,
>
> Continuing various tests with GraphHopper at Android I'm in a specific
> situation with memory issues.
>
> I try loading a big graph (e.g. Japan) at application start (following
> the GH android sample app guidelines).
> First time all are ok, but if I perform some restarts of the app then
> eventually I see the following errors.
>
> My question: Is there a way to unload / free GH resources at
> application finish?
>
>
> Couldn't map buffer 456 of 588 at position 478150756 for 616562588
> bytes with offset 100, new fileLength:616562788
> java.lang.RuntimeException: Couldn't map buffer 456 of 588 at position
> 478150756 for 616562588 bytes with offset 100, new fileLength:616562788
>     at
> com.graphhopper.storage.MMapDataAccess.mapIt(MMapDataAccess.java:159)
>     at
> com.graphhopper.storage.MMapDataAccess.loadExisting(MMapDataAccess.java:241)
>     at
> com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:1355)
>     at com.graphhopper.GraphHopper.load(GraphHopper.java:669)
>     ...
> Caused by: java.io.IOException: mmap failed: EPERM (Operation not
> permitted)
>     at java.nio.MemoryBlock.mmap(MemoryBlock.java:119)
>     at java.nio.FileChannelImpl.map(FileChannelImpl.java:253)
>     at
> com.graphhopper.storage.MMapDataAccess.newByteBuffer(MMapDataAccess.java:177)
>     at
> com.graphhopper.storage.MMapDataAccess.mapIt(MMapDataAccess.java:151)
>     ... 14 more
> Caused by: libcore.io.ErrnoException: mmap failed: EPERM (Operation
> not permitted)
>     at libcore.io.Posix.mmap(Native Method)
>     at libcore.io.ForwardingOs.mmap(ForwardingOs.java:94)
>     at java.nio.MemoryBlock.mmap(MemoryBlock.java:116)
>     ... 17 more

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140425/93433f06/attachment.html>


More information about the GraphHopper mailing list