Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-03 Thread Duy Nguyen
On Thu, May 3, 2018 at 7:24 PM, Stefan Beller wrote: >>> +void clear_alloc_state(struct alloc_state *s) >>> +{ >>> + while (s->slab_nr > 0) { >>> + s->slab_nr--; >>> + free(s->slabs[s->slab_nr]); >> >> I think you're leaking memory here. Commit and tree objects ma

Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-03 Thread Stefan Beller
On Wed, May 2, 2018 at 1:50 PM, Jonathan Tan wrote: > On Tue, 1 May 2018 14:34:03 -0700 > Stefan Beller wrote: > >> +void *allocate_alloc_state(void) >> +{ >> + return xcalloc(1, sizeof(struct alloc_state)); >> +} >> + >> +void clear_alloc_state(struct alloc_state *s) >> +{ >> + while (s

Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-03 Thread Stefan Beller
On Wed, May 2, 2018 at 10:44 AM, Duy Nguyen wrote: > On Tue, May 1, 2018 at 11:34 PM, Stefan Beller wrote: >> #include "cache.h" >> #include "object.h" >> @@ -30,8 +31,25 @@ struct alloc_state { >> int count; /* total number of nodes allocated */ >> int nr;/* number of nodes

Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-03 Thread Duy Nguyen
On Tue, May 1, 2018 at 11:34 PM, Stefan Beller wrote: > @@ -501,9 +516,12 @@ void raw_object_store_clear(struct raw_object_store *o) > void object_parser_clear(struct object_parser *o) > { > /* > -* TOOD free objects in o->obj_hash. > -* You need to free(o->obj_hash) too

Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-02 Thread Jonathan Tan
On Tue, 1 May 2018 14:34:03 -0700 Stefan Beller wrote: > +void *allocate_alloc_state(void) > +{ > + return xcalloc(1, sizeof(struct alloc_state)); > +} > + > +void clear_alloc_state(struct alloc_state *s) > +{ > + while (s->slab_nr > 0) { > + s->slab_nr--; > + fre

Re: [PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-02 Thread Duy Nguyen
On Tue, May 1, 2018 at 11:34 PM, Stefan Beller wrote: > #include "cache.h" > #include "object.h" > @@ -30,8 +31,25 @@ struct alloc_state { > int count; /* total number of nodes allocated */ > int nr;/* number of nodes left in current allocation */ > void *p; /* firs

[PATCH 13/13] alloc: allow arbitrary repositories for alloc functions

2018-05-01 Thread Stefan Beller
We have to convert all of the alloc functions at once, because alloc_report uses a funky macro for reporting. It is better for the sake of mechanical conversion to convert multiple functions at once rather than changing the structure of the reporting function. We record all memory allocation in al