On Thu, Nov 13, 2003 at 08:19:36 -0400, Allan.Bezerra@indt.org.br wrote: > Hi all, > > I was trying to get the stack, heap, data and code size separately allocated in physical memory but I did not manage to get them from /proc. > > I took a look the linux kernel source 2.6, but I did not discover any variables or structures about stack, heap, data and code size allocated in physical memory. > > I just found those information allocated in virtual memory. > > Please, could anybody help me? AFAIK there is no such information collected anywhere. AFACT it's actualy impossible. When process allocates memory, kernel only adds an entry into it's page table. The allocation is accounted for, but the allocated page does not exist anywhere -- it's only a promiss. The page is actualy allocated in a page fault handler when the process tries to access it. It does not bother to look, whether it's a code, data, stack, etc. page. It only looks whether the page exists and from what file (or swap) it should be loaded. You should note, that the pages are swapped quite frequently, so the numbers change very often. Also process can't allocate from physical memory directly and only privileged processes can lock their pages there. And even that is done only if there is an extremely good reason to do it (usualy only daemons related to kernel do that). ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/