What would be a good way to determine the current heap size (VSZ) for a
process on Linux?
I always used sbrk(0) for that, which used to return the top of the
heap. However recently, to my dismay, I discovered that it does not work
on Linux – I successfully malloc()-ed 1GB, could confirm it with “ps -o
pid,vsz,args”, and yet sbrk(0) always returns the same value as right in
As a work around, I have to open /proc//stat and read out the 23d
field from there. However it is heavy and ugly, and I have a feeling
that such a thing should be done in a more elegant way.
Please help. Any suggestions will be greatly appreciated. I even tried
to play with mallinfo(), however could not figure out how to interpret