Profiling Perl app memory usage

Peter Corlett abuse at cabal.org.uk
Fri Feb 3 14:12:08 GMT 2006


Nicholas Clark <nick at ccl4.org> wrote:
[...]
> Is wrapping a call to sbrk(0) with Inline::C good enough?

IME, modern systems will prefer to use anonymous mmap() space and only
fall back to sbrk() when that space is exhausted. The main reason
mmap() space can be released with munmap() but sbrk() space is not
released until the program exits, so sbrk() should only be used in an
emergency.

The default sizes on an i386 Linux box are 2GB of mmap() space and 1GB
of sbrk() space. So a call to sbrk(0) will only give you useful
information useful whe you have already consumed 2GB of memory, and
also will not tell you if the process shrinks.

-- 
PGP key ID E85DC776 - finger abuse at mooli.org.uk for full key


More information about the london.pm mailing list