On Fri, Jul 24, 2009 at 5:28 PM, Gennady
Bystritsky<Gennady.Bystritsky / quest.com> wrote:
> What would be a good way to determine the current heap size (VSZ) for a p=
rocess 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 Linu=
x -- I successfully malloc()-ed 1GB, could confirm it with "ps -o pid,vsz,a=
rgs", and yet sbrk(0) always returns the same value as right in the beginni=
ng.

It this topic related to ruby?

Well, type "man malloc" and look for MMAP_THRESHOLD.
Increasing MMAP_THRESHOLD large enough forces malloc() to use brk()
instead of mmap(). sbrk(0) doesn't care mmap()-ed memory.