Johannes Sixt wrote:
> Am 9/27/2013 14:10, schrieb Ramkumar Ramachandra:

>> +                                    v->s = xstrdup(buf);
>> +                            }
> These strdupped strings are leaked, right?

The convention seems to be that each refinfo owns its atom_value,
which owns its string that is kept on the heap.  Except when it isn't
(e.g., "v->s = typename(obj->type);").  So at least this patch doesn't
make the muddle any worse. ;-)

A nice followup would be to consistently allocate atom_value.s on the
heap, check for a GIT_FREE_AT_EXIT envvar, and free the refinfos
if that envvar is set at exit.  That would make sure that the code is
careful enough with memory to some day free some refinfo earlier when
there are many refs.  Until that's ready, I think continuing to mix
and match like this (constant strings left as is, dynamically
generated strings on the heap) is the best we can do.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to