git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] xmalloc: include size in the failure message

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 20, 2010, 13:01 UTC
Message-ID
<1282309272-20906-1-git-send-email-Matthieu.Moy@imag.fr>

Out-of-memory errors can either be actual lack of memory, or bugs (like code trying to call xmalloc(-1) by mistake). A little more information may help tracking bugs reported by users.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
This kind of thing may help for cases like
Subject: Out of memory error during git push
http://thread.gmane.org/gmane.comp.version-control.git/153988
 wrapper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wrapper.c b/wrapper.c
index afb4f6f..7057cbd 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -40,7 +40,7 @@ void *xmalloc(size_t size)
 		if (!ret && !size)
 			ret = malloc(1);
 		if (!ret)
-			die("Out of memory, malloc failed");
+			die("Out of memory, malloc failed (tried to allocate %u bytes)", size);
 	}
 #ifdef XMALLOC_POISON
 	memset(ret, 0xA5, size);
-- 
1.7.2.1.83.ge0227
Next: Junio C Hamano
Message 1 of 4 in “xmalloc: include size in the failure message”
  1. xmalloc: include size in the failure messageMatthieu Moy, Aug 20, 2010
  2. Junio C HamanoAug 20, 2010
  3. xmalloc: include size in the failure messageMatthieu Moy, Aug 20, 2010
  4. Junio C HamanoAug 20, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.