On Tue, May 8, 2018 at 10:04 PM, Jonathan Tan <jonathantanmy@xxxxxxxxxx> wrote: > On Tue, 8 May 2018 12:37:36 -0700 > Stefan Beller <sbeller@xxxxxxxxxx> wrote: > >> +void clear_alloc_state(struct alloc_state *s) >> +{ >> + while (s->slab_nr > 0) { >> + s->slab_nr--; >> + free(s->slabs[s->slab_nr]); >> + } > > I should have caught this earlier, but you need to free s->slabs itself > too. And nobody frees 's' either. I'm not saying cler_alloc_state() should, but somebody should. When I tried repo_clear(the_repository) with gitster/sb/object-store-alloc I got this ==13250== 944 (32 direct, 912 indirect) bytes in 1 blocks are definitely lost in loss record 62 of 88 ==13250== at 0x4C2CF25: calloc (vg_replace_malloc.c:718) ==13250== by 0x1AB7A8: xcalloc (wrapper.c:160) ==13250== by 0x1BF666: allocate_alloc_state (alloc.c:41) ==13250== by 0x140090: parsed_object_pool_new (object.c:462) ==13250== by 0x16CCF4: initialize_the_repository (repository.c:18) ==13250== by 0x110BD0: main (common-main.c:37) If you want to reproduce, this is what I used to test this with. https://gist.github.com/pclouds/86a2df6c28043f1b6fa3d4e72e7a1276 -- Duy