This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Something is broken in repack
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- To: ae at op5 dot se
- Cc: nico at cam dot org, jonsmirl at gmail dot com, gitster at pobox dot com, gcc at gcc dot gnu dot org, git at vger dot kernel dot org
- Date: 14 Dec 2007 16:03:26 -0000
- Subject: Re: Something is broken in repack
- References: <4760E005.6040102@op5.se>
Hi,
> >> if (progress->total) {
> >> unsigned percent = n * 100 / progress->total;
> >> if (percent != progress->last_percent || progress_update) {
> >> + struct mallinfo m = mallinfo();
> >> progress->last_percent = percent;
> >> - fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
> >> - progress->title, percent, n,
> >> - progress->total, tp, eol);
> >> + fprintf(stderr, "%s: %3u%% (%u/%u) %u/%uMB%s%s",
> >> + progress->title, percent, n, progress->total,
> >> + m.uordblks >> 18, m.fordblks >> 18,
> >> + tp, eol);
> >
> > Note: I didn't know what unit of memory those blocks represents, so the
> > shift is most probably wrong.
> >
>
> Me neither, but it appears to me as if hblkhd holds the actual memory
> consumed by the process. It seems to store the information in bytes,
> which I find a bit dubious unless glibc has some internal multiplier.
mallinfo() will only give you the used memory for the main arena.
When you have separate arenas (likely when concurrent threads have
been used), the only way to get the full picture is to call
malloc_stats(), which prints to stderr.
Regards,
Wolfram.