apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zengwm <800...@gmail.com>
Subject Why the 'size' is aligned twice in apr_pCalloc()
Date Mon, 12 May 2008 03:19:49 GMT
Hi, I have a question of aligning the 'size' in apr_pCalloc() [apr_pools.c].

apr_pCalloc() calls apr_palloc() to do the memory allocation in the
pool. It aligns the 'size' parameter before calling apr_palloc(). And
the size is aligned again in apr_palloc().

Why 'size' has to be aligned twice? Can the first alignment ( in
apr_pCalloc() ) be omitted?

I don't think omitting the first alignment will affect the memset()
call later in apr_pCalloc(), because, from the users' point of view,
it's guaranteed that all the memory he can see has been Zero-out.


View raw message