[maemo-developers] C - Hildon - Memory usage

From: Eero Tamminen eero.tamminen at nokia.com
Date: Tue Feb 12 16:50:40 EET 2008
Hi,

ext Markku Vire wrote:
> HildonFileChooser can temporarily allocate large amounts of memory.
> This goes away after all references to the chooser are removed.
> 
> However, the heap can shrink only when the topmost allocation is free'd.
> This means that
> 
>    XXX.....................Y
> 
> the last allocation (Y) is preventing the free memory between X and Y to
> be released back to system. In your example you're leaking
> chooser_filename. With enough bad luck it can keep your process from
> freeing memory it doesn't need anymore...
> 
> However, the VMSize is *not* a good way to measure memory usage. You
> should check private dirty memory instead.

With for example something like this:
awk '/Private_Dirty/{sum+=$2}END{print sum "kB"}' /proc/$(pidof 
myprogram)/smaps


	- Eero

More information about the maemo-developers mailing list