On Sat, 10 Sep 2005 17:59:00 -0700, "Steve Peters via RT"
<[EMAIL PROTECTED]> wrote:

> > [nicholas - Wed Jun 01 08:09:31 2005]:
> > 
> > This is a bug report for perl from [EMAIL PROTECTED],
> > generated with the help of perlbug 1.35 running under perl v5.9.3.
> > 
> > 
> > -----------------------------------------------------------------
> > [Please enter your report here]
> > 
> > Darwin provides 2 extra malloc() functions:
> > 
> >      The malloc_size() function returns the size of the memory block
> >    that
> >      backs the allocation pointed to by ptr.  The memory block size is
> >    always
> >      at least as large as the allocation it backs, and may be larger.
> > 
> >      The malloc_good_size() function rounds size up to a value that
> >    the allo-
> >      cator implementation can allocate without adding any padding and
> >    returns
> >      that rounded up value.
> > 
> > It's not clear if any other malloc implementations provide these
> >    functions, or
> > the same functionality with another name, apart from Perl's own
> >    malloc's
> > malloced_size
> > 
> > It would be useful to probe for them, because if they either are found
> >    it would
> > allow efficiency savings in various places. Specifically when buffers
> >    allocated
> > for SvPVX() we could set SvLEN() to the true maximum length, and AV
> >    storage
> > extension could be tuned to use all the memory malloc() actually gave
> >    us.
> > 
> 
> Adding the detection for these function is pretty simple, and Configure
> doesn't need to do anything more that standard libc scanning.  I'm guessing
> it would be easy to add to Metaconfig to check.  The following patches can
> do it for playing with, but don't apply to p4.
> 
> Merijn, do you need any more information for the Metaconfig changes?
> 
> --- Configure.old       Tue Sep  6 09:38:43 2005
> +++ Configure   Sat Sep 10 19:44:50 2005
> @@ -550,6 +550,8 @@
>  d_lseekproto=''
>  d_lstat=''
>  d_madvise=''
> +d_malloc_size=''
> +d_malloc_good_size=''
>  d_mblen=''
>  d_mbstowcs=''
>  d_mbtowc=''
> @@ -14247,6 +14249,14 @@
>  set madvise d_madvise
>  eval $inlibc
>  
> +: see if malloc_size exists
> +set malloc_size d_malloc_size
> +eval $inlibc
> +
> +: see if malloc_size_good exists
> +set malloc_good_size d_malloc_good_size
> +eval $inlibc
> +
>  : see if mblen exists
>  set mblen d_mblen
>  eval $inlibc
> @@ -21112,6 +21122,8 @@
>  d_lseekproto='$d_lseekproto'
>  d_lstat='$d_lstat'
>  d_madvise='$d_madvise'
> +d_malloc_size='$d_malloc_size'
> +d_malloc_size_good='$d_malloc_size_good'
>  d_mblen='$d_mblen'
>  d_mbstowcs='$d_mbstowcs'
>  d_mbtowc='$d_mbtowc'
> 
> --- config_h.SH.old     Tue Jun 21 14:56:18 2005
> +++ config_h.SH Sat Sep 10 19:22:05 2005
> @@ -3889,6 +3889,18 @@
>   */
>  #$d_libm_lib_version LIBM_LIB_VERSION          /**/
>  
> +/* HAS_MALLOC_SIZE
> + *      This symbol, if defined, indicates that the malloc_size
> + *      routine is available for use.
> + */
> +#$d_malloc_size HAS_MALLOC_SIZE         /**/
> +
> +/* HAS_MALLOC_GOOD_SIZE
> + *      This symbol, if defined, indicates that the malloc_good_size
> + *      routine is available for use.
> + */
> +#$d_malloc_good_size HAS_MALLOC_GOOD_SIZE         /**/
> +
>  /* HAS_NL_LANGINFO:
>   *     This symbol, if defined, indicates that the nl_langinfo routine is
>   *     available to return local data.  You will also need <langinfo.h>

I'll see. Looks complete.
I'll also have to add this to handy.h, unless you have a real location where
these new `things' are referenced.

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2  on HP-UX 10.20, 11.00 & 11.11,
 AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http://www.cmve.net/~merijn
Smoking perl: http://www.test-smoke.org,    perl QA: http://qa.perl.org
 reports  to: [EMAIL PROTECTED],                perl-qa@perl.org

Reply via email to