Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Mar 2005 21:19:25 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        freebsd-questions@freebsd.org
Cc:        Anthony Atkielski <atkielski.anthony@wanadoo.fr>
Subject:   Re: What's the minimum memory for a process in FreeBSD 5.3?
Message-ID:  <20050306201925.GA70082@slackbox.xs4all.nl>
In-Reply-To: <1718332183.20050306183745@wanadoo.fr>
References:  <1108086284.20050306153626@wanadoo.fr> <20050306164018.GB68992@slackbox.xs4all.nl> <1718332183.20050306183745@wanadoo.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

--9jxsPFA5p3P2qPhR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Mar 06, 2005 at 06:37:45PM +0100, Anthony Atkielski wrote:
> Roland Smith writes:
>=20
> > Shared libraries, stack space, heap space.
>=20
> Why would shared libraries be charged against the process--they should
> be common to every process, right?

As I understand it (correct me if I'm wrong), there is only one instance
of a shared library in memory. But it is mmapped into the address space
of every process that uses it.

> How much stack and heap space is allocated by default, and is it
> individually or globally configurable?

In a typical process layout in memory, the code (text), initialized data
(data) and uninitialized data (bss) are on the low end of the virtual
address space (typically starting at page 1), with the heap growing
up. The environment, arguments and stack are at the top of the address
space, with the stack  growing down.

Stack and heap space for a process are extended by the kernel as
needed. There is a stack limit that can be set with ulimit. Execute
'ulimit -a' to see what is it. So you can set this value, but I'm not
sure if this is wise. Setting this limit lower will not make the amount
of memory that they use smaller, but they will probably page-fault if
they hit the stack limit. I'm not sure that's the behavior you're
looking for. :-)

Shared libraries are mmaped between the heap and the stack limit, and
their pages are marked read-only, AFAIK.

Roland
--=20
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in e-mail
http://www.xs4all.nl/~rsmith/         X     No Word docs in e-mail
public key: http://www.keyserver.net / \    Respect for open standards

--9jxsPFA5p3P2qPhR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQFCK2XNEnfvsMMhpyURAthoAJ40eDvwjsC7Bh68b5LD4qGR9156RACgl22I
Fw7PynkJnzPr8MeWlvoajOA=
=l4X8
-----END PGP SIGNATURE-----

--9jxsPFA5p3P2qPhR--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050306201925.GA70082>