[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locks and threads

From: Linas Vepstas
Subject: Re: Locks and threads
Date: Wed, 25 Mar 2009 22:40:16 -0500

2009/3/25 Neil Jerram <address@hidden>:

> #2 makes the symbols hash thread-safe, and it appears that this
> completely fixes the define-race problem.

I reviewed patch2 as best I could, but I'm cross-eyed
cause its late at night, and I don't know guile internals
well.  So I'm not sure my review means much.  However,
isn't the following a mem leak:

+static SCM
+intern_symbol (SCM symbol, const char *name, size_t len, size_t raw_hash)

+  /* Allocate new cell and bucket before locking the mutex. */
+  new_bucket = scm_acons (symbol, SCM_UNDEFINED, SCM_BOOL_F);

+  for (l = slot; !scm_is_null (l); l = SCM_CDR (l))

+         scm_i_pthread_mutex_unlock (&symbols_mutex);
+         return sym;

it looks to me like new_bucket is never released.
I assume that the scm_acons did a malloc, but
maybe not

I'm to tired to say anything meaningful about the rest ...


p.s. many thanks for chasing this stuff down and fixing it !
It is all a very pleasant surprise!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]