From: Johannes Sixt <j6t@kdbg.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Nicolas Pitre <nico@fluxnic.net>
Subject: [PATCH 2/2] Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used
Date: Sat, 8 May 2010 17:18:06 +0200 [thread overview]
Message-ID: <201005081718.07355.j6t@kdbg.org> (raw)
In-Reply-To: <201005081713.49937.j6t@kdbg.org>
This avoids a potential race condition when async procedures are
implemented as threads where release_pack_memory() can be called from
different threads without locking under memory pressure.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
It is worthwhile to have this in np/malloc-threading (and in maint or
master) even if js/async-thread is not in master, yet, because on
Windows we already have async procedures implemented in threads.
trace.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/trace.c b/trace.c
index 4229ae1..1e560cb 100644
--- a/trace.c
+++ b/trace.c
@@ -25,6 +25,10 @@
#include "cache.h"
#include "quote.h"
+void do_nothing(size_t unused)
+{
+}
+
/* Get a trace file descriptor from GIT_TRACE env variable. */
static int get_trace_fd(int *need_close)
{
@@ -72,6 +76,7 @@ void trace_printf(const char *fmt, ...)
if (!fd)
return;
+ set_try_to_free_routine(do_nothing); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
@@ -103,6 +108,7 @@ void trace_argv_printf(const char **argv, const char *fmt, ...)
if (!fd)
return;
+ set_try_to_free_routine(do_nothing); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
--
1.7.1.64.ga1799.dirty
next prev parent reply other threads:[~2010-05-08 15:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-02 16:12 What's cooking in git.git (May 2010, #01; Sun, 2) Junio C Hamano
2010-05-02 20:01 ` Johannes Sixt
2010-05-08 15:13 ` [PATCH 1/2] Have set_try_to_free_routine return the previous routine Johannes Sixt
2010-05-08 15:18 ` Johannes Sixt [this message]
2010-05-03 12:48 ` What's cooking in git.git (May 2010, #01; Sun, 2) Jakub Narebski
2010-05-03 18:54 ` Will Palmer
2010-05-04 0:25 ` jn/shortlog (Re: What's cooking in git.git (May 2010, #01; Sun, 2)) Jonathan Nieder
2010-05-04 1:56 ` jn/shortlog Jonathan Nieder
2010-05-04 2:52 ` [PATCH v2 0/5] jn/shortlog Jonathan Nieder
2010-05-04 2:57 ` [PATCH 1/5] Documentation/shortlog: scripted users should not rely on implicit HEAD Jonathan Nieder
2010-05-04 2:57 ` [PATCH 2/5] t4201 (shortlog): guard setup with test_expect_success Jonathan Nieder
2010-05-04 2:58 ` [PATCH 3/5] t4201 (shortlog): Test output format with multiple authors Jonathan Nieder
2010-05-04 2:59 ` [PATCH 4/5] shortlog: Document and test --format option Jonathan Nieder
2010-05-04 3:18 ` [PATCH 5/5] pretty: Respect --abbrev option Jonathan Nieder
2010-05-04 8:34 ` Jonathan Nieder
2010-05-08 16:43 ` What's cooking in git.git (May 2010, #01; Sun, 2) Clemens Buchacher
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=201005081718.07355.j6t@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@fluxnic.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.