David Miller, Fri, Dec 14, 2007 20:17:36 +0100:
++ git show-ref -q refs/remotes/local/master
++ git branch my3 local/master
fatal: Out of memory, malloc failed
Something unusual about the system? Like a malloc debugger in
LD_PRELOAD configuration?
Maybe you could retry with a little bit instrumentation?
(The program last failed (git-branch) is normally very benign...)
Something like this:
diff --git a/git-compat-util.h b/git-compat-util.h
index 79eb10e..a9cc249 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -230,7 +230,8 @@ static inline char* xstrdup(const char *str)
return ret;
}
-static inline void *xmalloc(size_t size)
+#define xmalloc(size) xmalloc_((size),__FILE__,__LINE__)
+static inline void *xmalloc_(size_t size, const char *file, int line)
{
void *ret = malloc(size);
if (!ret && !size)@@ -241,7 +242,8 @@ static inline void *xmalloc(size_t size)
if (!ret && !size)
ret = malloc(1);
if (!ret)
- die("Out of memory, malloc failed");
+ die("Out of memory, malloc(%u) at %s:%d failed",
+ size, file, line);
}
#ifdef XMALLOC_POISON
memset(ret, 0xA5, size);@@ -263,7 +265,8 @@ static inline char *xstrndup(const char *str, size_t len)
return xmemdupz(str, p ? p - str : len);
}
-static inline void *xrealloc(void *ptr, size_t size)
+#define xrealloc(ptr,size) xrealloc_((ptr),(size),__FILE__,__LINE__)
+static inline void *xrealloc_(void *ptr, size_t size, const char *file, int line)
{
void *ret = realloc(ptr, size);
if (!ret && !size)@@ -274,7 +277,8 @@ static inline void *xrealloc(void *ptr, size_t size)
if (!ret && !size)
ret = realloc(ptr, 1);
if (!ret)
- die("Out of memory, realloc failed");
+ die("Out of memory, realloc(%u) at %s:%d failed",
+ size, file, line);
}
return ret;
}