Skip to content

Commit

Permalink
alloc: include any-object allocations in alloc_report
Browse files Browse the repository at this point in the history
When 2c1cbec (Use proper object allocators for unknown
object nodes too, 2007-04-16), added a special "any_object"
allocator, it never taught alloc_report to report on it. To
do so we need to add an extra type argument to the REPORT
macro, as that commit did for DEFINE_ALLOCATOR.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
peff authored and gitster committed Jun 12, 2014
1 parent e6dfcd6 commit c335d74
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ static void report(const char *name, unsigned int count, size_t size)
name, count, (uintmax_t) size);
}

#define REPORT(name) \
report(#name, name##_allocs, name##_allocs * sizeof(struct name) >> 10)
#define REPORT(name, type) \
report(#name, name##_allocs, name##_allocs * sizeof(type) >> 10)

void alloc_report(void)
{
REPORT(blob);
REPORT(tree);
REPORT(commit);
REPORT(tag);
REPORT(blob, struct blob);
REPORT(tree, struct tree);
REPORT(commit, struct commit);
REPORT(tag, struct tag);
REPORT(object, union any_object);
}

0 comments on commit c335d74

Please sign in to comment.