develooper Front page | perl.perl5.porters | Postings from October 2018

[perl #133439] Misleading output for calloc while -Dm in effect

From:
Tony Cook via RT
Date:
October 5, 2018 04:41
Subject:
[perl #133439] Misleading output for calloc while -Dm in effect
Message ID:
rt-4.0.24-28026-1538714507-1528.133439-15-0@perl.org
On Wed, 05 Sep 2018 21:06:12 -0700, tonyc wrote:
> On Fri, 10 Aug 2018 06:50:56 -0700, slaven@rezic.de wrote:
> > If -Dm is used then calloc() calls are logged like this:
> > 
> > 0x2cbf90930: (2217022366) calloc 32808 x 32808 bytes
> > 
> > It looks like approximately 1GB is allocated here. But the actual
> > DEBUG_m
> > call is the following:
> > 
> > DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%" UVxf ": (%05ld) calloc %ld
> > x %ld
> > bytes\n",PTR2UV(ptr),(long)PL_an++,(long)count,(long)total_size));
> > 
> > so the last number is not the single element size, but the total size
> > of the memory allocation.
> > 
> > Probably the output should look different here, for example
> > 
> > calloc %ld elements totalling %ld bytes
> > 
> > or
> > 
> > calloc %ld x %ld = %ld bytes", ... count, size, total_size
> > 
> > or so.
> 
> Something like the attached?

Applied as 2273039810f46a2ccd5940a26c7c04f8e039aa8f.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133439



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About