[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: incorrect malloc_stats output
From: |
wmglo |
Subject: |
Re: incorrect malloc_stats output |
Date: |
19 Aug 2003 08:20:28 -0000 |
Hi,
> Once Arena 0 reaches its limit of 1GB (TASK_UNMAPPED_BASE) malloc_stats
> output shows a large incorrect value (1.54Gb) for system bytes and in use
> bytes (which affects Total). The actual total memory usage here is about
> 1.5 - 1.6Gb (as reported by top) instead of 2.1gb.
...
> Secondly, the memory does seem to be allocated from main arena (sbrk'ed?)
> although TASK_UNMAPPED_BASE is supposed to limit it to 1GB. What is
> happening here ?? I ran a simple single threaded program that continually
> allocates memory and found main arena could exceed 1GB. Is that expected ?
Yes, _this_ is expected. First, foreign sbrk()s are counted as system
memory:
/* Count foreign sbrk as system_mem. */
if (old_size)
av->system_mem += brk - old_end;
Second, the main arena can also be extended beyond TASK_UNMAPPED_BASE
using mmap. This is a feature of Doug Lea's malloc-2.7.0 which I did
not disable. So, the main arena can exceed 1GB.
> However, the above is independent of the bug. malloc_stats actually ends
> up going to 4.5GB or so on my 4GB box. The Total below of 3.67Gb is
> ridiculous as user space ends at 3GB.
_That_ indeed looks bogus. Can you send me your test program?
Thanks,
Wolfram.