Re: free memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 16 November 2008 08:30:51 am Steve West wrote:
> I am running Fedora 9 x86 64 bit. I have 8 gigs of memory in the system.I
> wrote a program to malloc 4 gigs of memory space. Free shows nearly the
> same result before and during the execution of the program. Why does free
> not show that 4 gigs where allocated and used? How do I show the true
> memory usage?
>
> Steve

What you encounter is a documented, intended behavior. Different people refer 
to it by different names like delayed allocation or memory overcommit, but it 
addresses all the same issue. Essentially, there are so many programs out 
there that ask for memory and never use it, the kernel will overcommit 
memory. That means that malloc (with few exceptions) will succeed even if you 
don't really have that memory available. It isn't actually allocated until 
your process uses it. 

Change your program to touch every page of the memory you allocated (simple 
for loop accessing one word in each page is sufficient) and you'll see the 
memory usage of your program increase steadily. 

Search google for memory overcommit or delayed allocation. 
http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommit.html

Peter.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux