[PATCH] Fix talloc memlimits to work correctly with pools.

simo idra at samba.org
Tue Aug 27 16:41:49 MDT 2013


On Tue, 2013-08-27 at 15:33 -0700, Jeremy Allison wrote:
> On Tue, Aug 27, 2013 at 01:44:47PM -0700, Jeremy Allison wrote:
> > The current talloc_memlimit code is broken
> > w.r.t talloc_pools. It accounts for the
> > original pool allocation, and then also
> > counts all the sub-allocations from the
> > pool against the memlimit, which it
> > shouldn't (only the original pool
> > allocation actually does a malloc).
> > 
> > This patchset fixes that, and adds
> > a simple test case to show memory
> > limits working with pools.
> > 
> > After this local.talloc test is
> > valgrind clean.
> > 
> > Please review and push if you're
> > happy with it.
> > 
> > Once this is in I'll rebase Volker's
> > nested talloc pool patch on top of
> > it and submit that for review.
> 
> Here is the revised patchset
> with Simo's reviews applied.
> 
> Patch #1 - remove ssize_t code - don't use
> casts.
> 
> Patch #2 - make commit comment clearer.
> 
> Patch #7 - fix logic error I introduced.
> We must call _talloc_total_limit_size()
> if tc->limit || new_tc->limit).
> 
> Patch #10 - remove ssize_t size_change
> variable. Keep both old_size and new_size
> as size_t instead.
> 
> Cheers,
> 
> 	Jeremy.

ACK to 1-12 (13 already acked by Metze afaik, and I haven't really
understood it anyway :)

Reviewed-by: Simo Sorce <idra at samba.org>

Simo.



More information about the samba-technical mailing list