Stefan Beller <[email protected]> wrote:
> Eric Wong writes:
> > I haven't checked for git, but I suspect we get speedups by not
> > calling free().  I've never needed to profile git, but free() at
> > exit has been a measurable bottleneck in other projects I've
> > worked on.  Often, free() was more expensive than *alloc().
> 
> Thanks for reiterating that original response I got back then :)

Heh, I suspected I missed some of the original discussion.

> > #ifdef FREE_ALL_MEMORY
> > static inline void optional_free(void *ptr) {}
> > #else
> > #  define FREE_ALL_MEMORY (0)
> > #  define optional_free(ptr) free(ptr)
> > #endif
> 
> Shouldn't that be "#ifndef" instead? I really like the
> "optional_free", I'll keep it in mind!

Yes, I got my conditionals backwards.  That's what I get
for being awake way past my bedtime :x

We may also want to find a way to annotate *alloc calls as
"lifetime" so they can pair with optional_free.
Maybe sparse can help with that?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to