From: Alif Wahid <alif.wahid@gmail.com>
To: git@vger.kernel.org
Subject: Git exhausts memory.
Date: Sat, 2 Apr 2011 16:01:59 +1100 [thread overview]
Message-ID: <BANLkTin=yUtzbZjs_92FHDfs62VFFuLHwg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]
Hi there,
I'm using Git v1.7.1 on Ubuntu v10.10 and unfortunately Git seems to
regularly exhaust the memory on my machine and fails to compress loose
objects and/or collect garbage.
My Intel based dual-core machine has 2 GB of RAM and 4 GB of swap
space. I need to track a working tree with a handful of really large
tarballs that rarely change and loads of really small text files that
change frequently. What I'm seeing is that over time whenever "git gc"
runs automatically it fails with the message "fatal: Out of memory,
malloc failed". So I've been trying to manually run "git repack -ad
--window-memory=1g --max-pack-size=1g" in the hope that Git will not
exceed the physical memory. But I still get the same error message :(
As I can't make my repository public, I've attached a simple Python
script that generates a ~1.3 GB file containing random integers (takes
roughly 10 min. on my machine). Then I run the following four commands
and get the out-of-memory failure from "git repack". This is
effectively emulating the scenario I have with my repository.
$ git init
$ git add ./test_data.dat
$ git commit ./test_data.dat -m "Test data."
$ git repack -ad --window-memory=1g --max-pack-size=1g
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
fatal: Out of memory, malloc failed
I can't find anything on the wiki about out-of-memory failures. Any
info/help would be much appreciated.
Regards
Alif
[-- Attachment #2: test_data.py --]
[-- Type: text/x-python, Size: 1048 bytes --]
#! /usr/bin/env python
import sys, os, random
if __name__ == '__main__':
fbuff = 2**28 # file buffer size in bytes
fints = 10**8 # number of integers to write
fsize = 12 # number of digits to write per integer
fname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
try:
os.mkdir(fname)
except OSError:
pass # directory already exists
fpath = os.path.join(fname, fname+'.dat')
fhand = open(fpath, 'w', fbuff)
sys.stdout.write('Writing %d MB to file \'%s\'\n' % (fints*(fsize+1)/10**6, fpath))
sys.stdout.write('This will take some time, please wait.\n')
sys.stdout.write('Progress:')
sys.stdout.flush()
random.seed(-1)
fform = '%'+str(fsize)+'d\n'
for x in xrange(fints):
fhand.write(fform % (random.randint(0,fints)))
if x % (fints/10) == 0 and x > 0:
sys.stdout.write('%3d/10' % (x/(fints/10)))
sys.stdout.flush()
sys.stdout.write(' 10/10\n')
sys.stdout.flush()
fhand.close()
next reply other threads:[~2011-04-02 5:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-02 5:01 Alif Wahid [this message]
2011-04-02 15:05 ` Git exhausts memory Nicolas Pitre
2011-04-03 9:15 ` Alif Wahid
2011-04-03 15:18 ` Nicolas Pitre
2011-04-04 12:52 ` Alif Wahid
2011-04-04 14:57 ` Nguyen Thai Ngoc Duy
2011-04-05 2:22 ` David Fries
2011-04-05 4:35 ` Alif Wahid
2011-04-05 11:13 ` Nguyen Thai Ngoc Duy
2011-04-05 11:26 ` Alif Wahid
2011-04-05 16:48 ` Holger Hellmuth
2011-04-05 17:06 ` Shawn Pearce
2011-04-05 17:44 ` Junio C Hamano
2011-04-05 20:56 ` Nicolas Pitre
2011-04-05 22:16 ` Junio C Hamano
2011-04-05 22:19 ` Shawn Pearce
2011-04-06 0:34 ` Nicolas Pitre
2011-04-06 15:51 ` Jay Soffian
2011-04-06 16:33 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTin=yUtzbZjs_92FHDfs62VFFuLHwg@mail.gmail.com' \
--to=alif.wahid@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).