What's the minimum memory for a process in FreeBSD 5.3?

Roland Smith rsmith at xs4all.nl
Sun Mar 6 12:47:18 PST 2005


On Sun, Mar 06, 2005 at 06:37:45PM +0100, Anthony Atkielski wrote:
> Roland Smith writes:
> 
> > Shared libraries, stack space, heap space.
> 
> 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
-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050306/68a41cd1/attachment.bin


More information about the freebsd-questions mailing list