[CentOS] top and allocation issues

Thu Mar 3 19:55:57 UTC 2011
Michael D. Berger <m_d_berger_1900 at yahoo.com>

On Thu, 03 Mar 2011 14:38:52 -0500, Brunner, Brian T. wrote:

[...]
> 
> Holy RAMbo, batman!  How many GB of RAM do you intend to allocate? Once
> you allocate 2GB like you did, you MUST be running a bigmem or x64
> kernel to allocate another 2GB.
> 
> You won't see 'new'd memory as "taken" in top(8) because malloc() is a
> bug.  Bits are set in a page table, but no memory is actually written
> to, and nothing really changes, until the program attempts to write.
> What you did was fall off the end of a bit string keeping track of
> malloc()'d pages, that's all.
> 
> (ps mark, the ++jj or jj++ takes place after the first loops' action,
> not before .:. ++jj and jj++ have identical effect).
> 
> Insert spiffy .sig here
[...]

Yes, I do expect to do a bit of arithmetic.  I will need
several blocks of about 0.5G, and I am checking the limits.
Is it true, then, that I won't really know if I succeeded with
the allocation until I try to write the memory? What will
happen then? Is there a way to check without actually writing?

Mike.