<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Emux,<br>
      <br>
      it looks like memory mapped file is not supported for this VM or
      something. Already the very first mmap fails for this call:<br>
      buf = raFile.getChannel().map(FileChannel.MapMode.READ_WRITE,
      offset, byteCount);<br>
      <br>
      Maybe you ask the vendor of that VM?<br>
      <br>
      Mapsforge just reads from the file and maintains a kind of a cache
      itself. We are a lot lazier for GraphHopper and just memory map
      the file which normally works very well where the OS maintains the
      cache for us.<br>
      <br>
      Regards,<br>
      Peter.<br>
      <br>
      <br>
    </div>
    <blockquote cite="mid:535BCE9D.9060209@gmail.com" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      Hi Peter,<br>
      <br>
      I use the various Genymotion VMs for debugging Android apps.<br>
      These VMs have the very useful feature 'Shared folders'.<br>
      i.e. at VirtualBox VM's settings you can define a shared folder
      from host OS<br>
      and see it inside the Android environment as mounted read/write
      folder.<br>
      <br>
      This can be help a lot during testing large mapsforge maps or GH
      graphs.<br>
      They can remain at host OS disk and not needed to copy them to
      device / emulator sdcard.<br>
      With the Mapsforge map library this feature works fine.<br>
      <br>
      But when I try loading a graph that exists at this read/write
      mounted folder the following exceptions are thrown:<br>
      <br>
      Couldn't map buffer 0 of 31 at position 100 for 32505756 bytes
      with offset 100, new fileLength:32505956<br>
      java.lang.RuntimeException: Couldn't map buffer 0 of 31 at
      position 100 for 32505756 bytes with offset 100, new
      fileLength:32505956<br>
          at
      com.graphhopper.storage.MMapDataAccess.mapIt(MMapDataAccess.java:159)<br>
          at
com.graphhopper.storage.MMapDataAccess.loadExisting(MMapDataAccess.java:241)<br>
          at
com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:1355)<br>
          at com.graphhopper.GraphHopper.load(GraphHopper.java:670)<br>
          ...<br>
      Caused by: java.io.IOException: mmap failed: EINVAL (Invalid
      argument)<br>
          at java.nio.MemoryBlock.mmap(MemoryBlock.java:119)<br>
          at java.nio.FileChannelImpl.map(FileChannelImpl.java:253)<br>
          at
com.graphhopper.storage.MMapDataAccess.newByteBuffer(MMapDataAccess.java:177)<br>
          at
      com.graphhopper.storage.MMapDataAccess.mapIt(MMapDataAccess.java:151)<br>
          ... 14 more<br>
      Caused by: libcore.io.ErrnoException: mmap failed: EINVAL (Invalid
      argument)<br>
          at libcore.io.Posix.mmap(Native Method)<br>
          at libcore.io.ForwardingOs.mmap(ForwardingOs.java:94)<br>
          at java.nio.MemoryBlock.mmap(MemoryBlock.java:116)<br>
          ... 17 more<br>
      <br>
      <br>
      <div class="moz-signature">-- <br>
        <font color="#000000">Emux</font><br>
        <a moz-do-not-send="true"
          href="http://wiki.openstreetmap.org/wiki/Cruiser">Cruiser</a>
        - <a moz-do-not-send="true"
href="http://wiki.openstreetmap.org/wiki/Atlas_%28navigation_application%29">Atlas</a></div>
    </blockquote>
    <br>
  </body>
</html>