1

I wrote an app that uses a memory mapping to access file. Read speed increased dramatically, so it was a success.

As expected, the memory allocated for the ByteBuffer is not counted against the VM heap. In a heap dump, it appears that my app uses significantly less memory than it actually does.

My question is, what effect (if any) does this kind of allocation have on the device's memory management as it pertains to other apps? Does it make my app a "bad citizen" of the Android ecosystem?

Kevin Krumwiede
  • 9,868
  • 4
  • 34
  • 82
  • It all depends how much memory you're mapping. All resources have to come from somewhere. Last time I measured memory mapping speed it was only 20% faster than other techniques. Maybe your measurements aren't accurate? – user207421 Mar 06 '17 at 09:03
  • @EJP Around 25 MB. Memory mapping cut the read time from 10 seconds to around 2 seconds. (Other similar apps also load the same file in around 10 seconds, so my original implementation wasn't particularly slow.) – Kevin Krumwiede Mar 06 '17 at 19:38
  • 1
    That's remarkable. Was the 10 second implementation buffered? – user207421 Mar 07 '17 at 01:09

0 Answers0