apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: memory leak in apr_buck_alloc...
Date Tue, 10 Sep 2002 19:02:57 GMT
[Moving to dev@apr.apache.org]

> From: Cliff Woolley [mailto:jwoolley@virginia.edu]
> Sent: 09 September 2002 22:42

> On Mon, 9 Sep 2002, Brad Nicholes wrote:
> 
> >      Has anybody else noticed a memory leak when requesting pages less
> > than 8k?  If I repeatedly request pages less than 8k I have noticed that
> > apr_bucket_alloc() calls allocator_alloc() which seems to continuously
> > malloc() memory rather than finding it in the free list.  The reason why
> > is because allocator->max_index seems to always be 0 and contain no free
> > nodes.  If I request pages greater than 8k, allocator->max_index appears
> > to be 2.  I can't seem to figure out why the bucket allocator passed in
> > by apr_bucket_alloc always contains a max_index of 0 on small page
> > requests.  Any ideas?
> 
> Ughuuhhhhhh ... good question!  I'll let Sander take a stab at that one
> before I try to dig in and see what's going on... but I will do so if no
> answers are forthcoming in the near-term.

I think max_index is misunderstood.  allocator->max_index is the index of
the biggest block available.  index = block_size / boundary_size - 1, where
boundary_size is 4096.  Keeping track of max_index prevents us from scanning
the entire array of free lists (of different block sizes).

Anyhow, I'm still investigating.  Haven't found the/a problem yet in the code.
But then again, I might be missing the obvious.  Extra eyes welcome.


Sander

Mime
View raw message