Re: memory allocation: smap large "Size", but unused
From: David Rientjes
Date: Tue Nov 27 2012 - 17:00:09 EST
On Tue, 27 Nov 2012, Bernd Schubert wrote:
> I'm just investigating why a user space program has a rather large VmSize, but
> small VmRSS size. Looking into /proc/$pid/smaps I notice several areas with an
> size of about 64MB, but otherwise that area is unused. So far I did not find a
> way how to reproduce that with malloc() calls.
>
> 7ffd34021000-7ffd38000000 ---p 00000000 00:00 0
> Size: 65404 kB
> Rss: 0 kB
What happens if you do
sbrk(65404 << 10);
sleep(1000);
and check /proc/pid/smaps? Ah, a memory range need not have any pages in
memory.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/