[CentOS] top and allocation issues

Thu Mar 3 20:03:34 UTC 2011
Stephen Harris <lists at spuddy.org>

On Thu, Mar 03, 2011 at 07:55:57PM +0000, Michael D. Berger wrote:
> 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?

/proc/sys/vm/overcommit_memory
(or sysctl vm.overcommit_memory)

>From the kernel Documentation:

This value contains a flag that enables memory overcommitment.

When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.

When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.

When this flag is 2, the kernel uses a "never overcommit"
policy that attempts to prevent any overcommit of memory.

This feature can be very useful because there are a lot of
programs that malloc() huge amounts of memory "just-in-case"
and don't use much of it.

The default value is 0.


> 
> Mike.
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

-- 

rgds
Stephen