I'm not 100% sure, but I think there is more than one memory pool in that process. Maybe malloc is keeping separate pools per thread to reduce locking requirements.
Look at a typical pair of your lines, such as
Code:
00007f0054000000 132K 24K 24K 24K 0K rw-p [anon]
00007f0054021000 65404K 0K 0K 0K 0K ---p [anon]
That indicates one of your pools did fill and the library code asked for one mapping of (65404+132)K more memory for that pool. Then six 4K pages of that were actually used and physical memory allocated.
Quote:
Why does 65404k anonymous have "---p" perm? What does it mean?
|
I don't quite understand the distinction (rw-p vs. ---p) between the untouched pages within the first 132K and the untouched pages in the remaining 65404K. Only 24K is allocated ram (correctly rw-p). All the rest (both inside and outside the first 132K) is just committed and wouldn't be allocated until used. So it should all be ---p. In those two lines I quoted, there ought to be only 24K of rw-p and the rest of the 132+65404 should be ---p.
I don't know whether there is a true difference in the states of the unallocated pages or whether it is just some data reduction effect in the way pmap reports things. But I'm pretty sure any difference (between the two kinds of committed unallocated pages) is not significant for your application
Quote:
If the first three 65404k anonymous memorys are used by process, this should be memory leak. But if the first three 65404k anonymous memorys are not used, why does the code managing the pool ask Linux to commit the forth 65404k anonymous memory?
|
None of those 65404K areas are used (yet). They are committed, not allocated. I think Linux commits the fourth of those before using the first because it has four pools inside one process (maybe four active threads).
But that 24K mentioned earlier does represent memory used later in execution when part of its pool that was enough at the beginning is no longer enough. I don't know enough about your application to estimate whether that represents a small memory leak (apparently in each of four different pools).