From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1863 Path: news.gmane.org!not-for-mail From: Ryan Woodrum Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Q: Determine memory consumption Date: Wed, 7 May 2008 22:53:35 -0700 Organization: Avvo, Inc. Message-ID: <200805072253.37442.rwoodrum@avvo.com> References: <200805061737.36069.list-supervision@augensalat.de> <200805060849.16523.rwoodrum@avvo.com> <200805072104.56067.list-supervision@augensalat.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart31047206.I39MaxGzn3"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1210226045 10982 80.91.229.12 (8 May 2008 05:54:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2008 05:54:05 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-2098-gcsg-supervision=m.gmane.org@list.skarnet.org Thu May 08 07:54:39 2008 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1Jtz5S-0000Ss-WA for gcsg-supervision@gmane.org; Thu, 08 May 2008 07:54:39 +0200 Original-Received: (qmail 13911 invoked by uid 76); 8 May 2008 05:54:15 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 13903 invoked from network); 8 May 2008 05:54:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on dns1.hcs.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.4 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 User-Agent: KMail/1.9.9 In-Reply-To: <200805072104.56067.list-supervision@augensalat.de> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1863 Archived-At: --nextPart31047206.I39MaxGzn3 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wednesday 07 May 2008 12:04:56 pm Bernhard Graf wrote: > On Tuesday 06 Mai 2008, Ryan Woodrum wrote: > > On Tuesday 06 May 2008 08:37:36 am Bernhard Graf wrote: > > > With softlimit (and ulimit) one can set several memory limits, most > > > interesting data and stack segment. > > > > > > How do I determine the actual memory consumption for data and stack > > > of a process? > > > With tools like ps and top I only get code + data + stack summed > > > up. > > > > Something like pmap? > > > > rwoodrum@frums:~$ pmap -d 888 > > 888: /bin/bash > > Address Kbytes Mode Offset Device Mapping > > 08048000 664 r-x-- 0000000000000000 008:00001 bash > > 080ee000 20 rw--- 00000000000a6000 008:00001 bash > > 080f3000 2572 rw--- 00000000080f3000 000:00000 [ anon ] > > b7c67000 28 r--s- 0000000000000000 008:00005 gconv-modules.cache > > b7c6e000 212 r--s- 0000000000000000 008:00006 passwd > > b7ca3000 1256 r---- 0000000000000000 008:00005 locale-archive > > b7ddd000 4 rw--- 00000000b7ddd000 000:00000 [ anon ] > > b7dde000 1312 r-x-- 0000000000000000 008:00001 libc-2.7.so > > b7f26000 4 r---- 0000000000148000 008:00001 libc-2.7.so > > b7f27000 8 rw--- 0000000000149000 008:00001 libc-2.7.so > > b7f29000 16 rw--- 00000000b7f29000 000:00000 [ anon ] > > b7f2d000 8 r-x-- 0000000000000000 008:00001 libdl-2.7.so > > b7f2f000 8 rw--- 0000000000001000 008:00001 libdl-2.7.so > > b7f31000 184 r-x-- 0000000000000000 008:00001 libncurses.so.5.6 > > b7f5f000 12 rw--- 000000000002d000 008:00001 libncurses.so.5.6 > > b7f77000 8 rw--- 00000000b7f77000 000:00000 [ anon ] > > b7f79000 104 r-x-- 0000000000000000 008:00001 ld-2.7.so > > b7f93000 8 rw--- 0000000000019000 008:00001 ld-2.7.so > > bfd11000 84 rw--- 00000000bffeb000 000:00000 [ stack ] > > ffffe000 4 r-x-- 0000000000000000 000:00000 [ anon ] > > mapped: 6516K writeable/private: 2740K shared: 240K > > Which one is the data section? Exploring some other options to answer this question looks like you could u= se=20 something like `size` or, if you have an object file, `objdump`. Check out: http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php Here's a sample run on /bin/ls: rwoodrum@slard:~$ size /bin/ls text data bss dec hex filename 88264 908 1132 90304 160c0 /bin/ls I'm not learned enough off the top of my head to know how this changes (if = it=20 does indeed) once a process is running. I would think that it could if it= =20 maps in other stuff at runtime. However, with regard to the pmap output, you can possibly make some educate= d=20 guesses based on the modes of the segments of memory as well as their=20 location. Text pages, for example, are not writable as this could obviousl= y=20 lead to Bad Things. The stack segment is also at the high address and grow= s=20 downward whereas the text and data segments are at the low end of the addre= ss=20 space and grow upward. Just thinking randomly, it might also be possible to force a core and exami= ne=20 it for the same answers. Hope this helps! =2Dryan woodrum rwoodrum@avvo.com --nextPart31047206.I39MaxGzn3 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBIIpVhM0/3fhHHQOwRAoJYAKDT9I1Vg1W7od9k2zKgC1vwTbf3tgCePsKC wiNzfM7jVXTh0OeyKY1cyRI= =To20 -----END PGP SIGNATURE----- --nextPart31047206.I39MaxGzn3--