memory reported under linux higher that allocated?

John Wendel john.wendel at metnet.navy.mil
Thu Feb 14 22:30:59 UTC 2008


Benoit Tremblay wrote:
>   Hi,
>  
> I have 4 gig of RAM and when I allocate 3 gig the <top> utilities show 
> that my application is using 87% of the available RAM, so it's a half a 
> gig more, why? The application is not doing any disk access.
>  
> I just do a couple of malloc and the same amount of free at exit. I 
> count all malloc by incrementing a "m" variable and I decrement the same 
> "m" variable when doing free and at the program exit I display the value 
> of "m" and it is zero. I stop doing malloc when my "m" variable reach 3 
> gigabytes so I am sure I allocate only 3 gigabytes so why my application 
> is using 87% of all available RAM?
>  
> Benoit
> 

What is the "available" RAM before your app starts? It is less than 4 
GB, since there is a lot of other stuff running in addition to your app.

How much memory is you app using that isn't part of the malloc request?

John




More information about the fedora-list mailing list