Skip to content
rtyley edited this page Aug 13, 2012 · 6 revisions

Mobile devices don't have as much memory as desktop computers, and on an Android device the amount of memory available to app processes is relatively low (even a Nexus 7 tablet only makes around 64MB available). Although the underlying JGit library used by Agit does it's best to stream large files and not hold them all in-memory at one time, the way Git stores and transmits files in packfiles can cause memory consumption to behave in unpredictable ways.

For example, see this repo with a large file:

https://github.com/kosborn/p2p-adb/commit/7ca8a626b86068031bfdc545edc4bc521e509008#includes/gesture_hash.txt

Large objects are streamed wherever possible and consequently files of this size often won't cause problems, even on a relatively memory constrained device like an Android. That works so long as the large object is stored as a whole object within the Git packfile. However, if the file is similar to any other file stored anywhere within the repositories history, they can both be stored in delta format - which unfortunately requires a full in-memory representation to decompress - and the Android device blows up with an OutOfMemoryError.

The above commit in the p2p-adb repository is a change to the gesture_hash.txt file, which will have pushed it into delta representation and made it almost impossible to decompress on a low-memory device.

This is why I wince whenever I see people checking large files into source control - personally I wouldn't include any file over ~2 MB in size... given it's a generated file, I would have just included the generating script in the repo, along with possibly a checksum for the generated file - and let people get the hashfile by web download if they want to.

Clone this wiki locally