{"thread":{"id":"13438","subject":"GIT max file size.","startedAt":"2008-05-08T16:33:12Z","lastAt":"2008-05-08T20:46:40Z","messageCount":3,"participants":["epankala@cc.hut.fi","Alex Riesen","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"76381","messageId":"48232B48.9010900@cc.hut.fi","threadId":"13438","inReplyTo":null,"subject":"GIT max file size.","fromName":"epankala@cc.hut.fi","fromEmail":"epankala@cc.hut.fi","sentAt":"2008-05-08T16:33:12Z","receivedAt":"2008-05-08T16:33:12Z","isPatch":false,"sender":{"key":"epankala@cc.hut.fi","avatar":null},"body":"Hello.\n\nI received \"fatal: Out of memory, malloc failed\" error when I tried to\ncheck in file of ~2.5G\n\nIt can be argued that binary file of that size (or binary file\naltogether) has no place in version control anyways, but still I pursued\nit a bit more.\n\nIn #git@freenode channel I received some hints and in the end I started\nrunning\n\"git-hash-object -w images/filesystem_ext2.img.bz2\"\n\nIt would seem that sha1_file.c:write_sha1_file() has defined size\nvariable as integer.\n\nThis wraps around in \"size = 8 + deflateBound(&stream, len+hdrlen);\" and\ngives big number for mmap()\nmmap(NULL, 18446744071976239104, PROT_READ|PROT_WRITE,\nMAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)\n\nsize is used in \"stream.avail_out = size;\" and zstream.avail_out seems\nto be unsigned int\n\"uInt     avail_out; /* remaining free space at next_out */\"\n\nIf size would be changed to unsigned would the max filesize be increased\nto ~4G or would it blow up elsewhere?\n\nIs git going to support >2G files or is having \"everything that is\nneeded to complete build process from beginning to bitter end\" in\nversion control something that git is not meant for?\n\nIf latter is true then this would be pretty much pointless change. If\nformer then changing 'size' to integer won't be enough anyways...\n\n\nBest Regards\nJanne Pänkälä\n\n-- \nJanne Pänkälä\n"},{"id":"76395","messageId":"81b0412b0805081146s2f16f256u39717f107ff91c02@mail.gmail.com","threadId":"13438","inReplyTo":"48232B48.9010900@cc.hut.fi","subject":"Re: GIT max file size.","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-05-08T18:46:15Z","receivedAt":"2008-05-08T18:46:15Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/5/8 epankala@cc.hut.fi <epankala@cc.hut.fi>:\n>  Is git going to support >2G files\n\nMaybe sometime. For now, the error could be handled better.\n\n> ... or is having \"everything that is\n>  needed to complete build process from beginning to bitter end\" in\n>  version control something that git is not meant for?\n\nThat was the plan :)\n"},{"id":"76403","messageId":"alpine.LFD.1.10.0805081334530.2940@woody.linux-foundation.org","threadId":"13438","inReplyTo":"48232B48.9010900@cc.hut.fi","subject":"Re: GIT max file size.","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-05-08T20:46:40Z","receivedAt":"2008-05-08T20:46:40Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 8 May 2008, epankala@cc.hut.fi wrote:\n> \n> I received \"fatal: Out of memory, malloc failed\" error when I tried to\n> check in file of ~2.5G\n\nThere's two issues there.\n\nOne is that a lot of what git does is simply \"whole file at a time\". The \ndiff machinery, and a lot of the core stuff, simply just expects to be \nable to mmap() or read the whole file in one go. So on a 32-bit \narchitecture, you'll generally be limited to the size of the address \nspace, not to anything else.\n\nThe other thing is then that (partly because of the above) there probably \nare places where we haven't been as careful about size-type things as we \ncould have been. A lot of the code uses size_t, but I bet not everything \ndoes.\n\n\t\tLinus\n"}]}