* memory allocation: smap large "Size", but unused
@ 2012-11-27 18:28 Bernd Schubert
2012-11-27 22:00 ` David Rientjes
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Schubert @ 2012-11-27 18:28 UTC (permalink / raw)
To: linux-kernel
Hello,
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
Pss: 0 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 0 kB
Anonymous: 0 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Any idea how to do such an allocation from user space?
Thanks,
Bernd
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: memory allocation: smap large "Size", but unused
2012-11-27 18:28 memory allocation: smap large "Size", but unused Bernd Schubert
@ 2012-11-27 22:00 ` David Rientjes
0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2012-11-27 22:00 UTC (permalink / raw)
To: Bernd Schubert; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-27 22:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-27 18:28 memory allocation: smap large "Size", but unused Bernd Schubert
2012-11-27 22:00 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).