sbrk(0) replacement for memory resource tracking?
Dag-Erling Smørgrav
des at des.no
Fri Nov 18 11:12:27 UTC 2016
Matthias Andree <matthias.andree at gmx.de> writes:
> OTOH, e2fsprogs uses only sbrk(0) to track its overall memory use, and
> only to track its resource usage. I'll be happy to help porting to
> something else that serves the same purpose, aka "how much memory am I
> using" - but what would that be?
Ideally, the realization that the numbers you get from sbrk() are
completely meaningless, followed by removal of that code.
And I don't just mean that they're meaningless because jemalloc() uses
mmap() - they were meaningless before jemalloc(), because they only tell
you how much address space the program has allocated, not how much of it
is actually in use. And even if it did, it wouldn't tell you anything
about memory pressure, how much of the program's memory is swapped out,
etc. It's like asking how long a road is and then claiming to know
where you are based on that answer. You don't - all you know is how far
you could have gone without a break if you'd started at one end and kept
going. And for all you know, there may be a section that's closed for
repairs.
DES
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-hackers
mailing list