apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)" <mad...@hp.com>
Subject RE: [PATCH] apr_rmm.c
Date Fri, 18 Apr 2003 16:51:43 GMT

>-----Original Message-----
>From: Justin Erenkrantz [mailto:justin@erenkrantz.com]

>> Question : Is 8 sufficient ?. What if there is a "long double"
>> in some data structure - where the allocation would change
>> again.. The apr_rmm headers are probably okay - the compiler
>> always allocates 16  bytes.
>> OR, is it better to have the value '8' in APR_ALIGN_DEFAULT 
>to be determined during the configure phase ?.
>It's not necessarily about the long double (or the largest element 
>in a structure) - AIUI, it's that the base pointer needs to be
>aligned by 8 rather than 4.  I don't believe it has anything to do
>with the internal structure.
>Since all of the pool allocated memory is currently aligned by 8,
>I've got to imagine that's sufficient.  If it weren't, then you'd
>see a SIGBUS on all memory operations.  If we had to grow the
>alignment for a specific platform, we'd do it in APR_ALIGN_DEFAULT.
>So, that seems to me to be the right strategy for apr_rmm.

That is correct [I don't know what I was thinking when I wrote the mail :(]

The following patch works for me. Any comments ?

Index: apr_rmm.c
RCS file: /home/cvspublic/apr-util/misc/apr_rmm.c,v
retrieving revision 1.18
diff -u -r1.18 apr_rmm.c
--- apr_rmm.c   1 Jan 2003 00:02:22 -0000       1.18
+++ apr_rmm.c   18 Apr 2003 16:47:19 -0000
@@ -321,7 +321,7 @@
     long *pl;
-static const apr_size_t grain = sizeof(union grainbit);
+static const apr_size_t grain = APR_ALIGN_DEFAULT(sizeof(union grainbit));
 APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t

View raw message