apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luke Kenneth Casson Leighton <l...@samba-tng.org>
Subject Re: [PATCH] sms blocks
Date Thu, 14 Jun 2001 13:40:58 GMT
you are aware that strictly speaking you are _not_ supposed
to treat memory addresses as contiguous?

one of the reasons why void* _is_ void* is because
potentially, areas of memory allocated by a system
may be from different regions, and not contiguous.


a1 = malloc(100)
a2 = malloc(100)
a3 = malloc(100)

if a1 < a2 < a3, then this may NOT be true.  uhm, someone
double-check this for me, do you know what i am reffering

(a2 - a1) + (a3 - a2) = (a3 - a1) |= true

is the hypothesis, and on certain OSes on certain hardware
this hypothesis may be WRONG.

so, be careful!


On Thu, Jun 14, 2001 at 09:14:06AM -0400, Cliff Woolley wrote:
> On Thu, 14 Jun 2001, Sander Striker wrote:
> > This patch implements getting memory from the parent if
> > the preallocated block is exhausted. There is one catch:
> > memory freed with apr_sms_free is recycled as if it were
> > a block of the given fixed size (passed in at create).
> > To actually free this 'external' memory, use reset (or
> > destroy, but that is a given).
> I'll look at this more closely later today, but just a quick thought: all
> that _free(sms,mem) would have to do to handle the external blocks is
> check to see if mem is between the start and end of the original block;
> if so, add it back to the free_list, if not, call _free(parent,mem).
> --Cliff
> --------------------------------------------------------------
>    Cliff Woolley
>    cliffwoolley@yahoo.com
>    Charlottesville, VA

View raw message