Monitoring Samba's memory usage: A cautionary tale

Christof Schmitt cs at
Wed Feb 3 19:53:28 UTC 2016

On Wed, Feb 03, 2016 at 10:22:06AM -0800, Richard Sharpe wrote:
> Hi folks,
> We spent a lot of time recently trying to understand Samba's memory usage
> and the incremental cost of an additional smbd. This was sparked by the
> fact that we had a couple of memory leaks in our VFS module.
> After we fixed the memory leaks we then spent an enormous amount of time
> down in the weeds because top and ps are not actually good tools for this.
> Specifically, they overstate the RSS size by including the text segments of
> all the shared libraries used.
> See, for example, this page:
> I still have not found the best tool for this, but you can use pmap and
> process the output to exclude all TDBs (because there will only be one copy
> of them in memory and thus they should count once) and the text regions of
> all shared libraries (all RO memory segments.)
> I hope this saves some people some time and also dispels the view held by
> some that Samba is a memory hog.
> Also, you can check for heap growth by looking at the size of the memory
> segment just before the stack. If that is constantly growing, you probably
> have a problem.

There is a feature in Linux to display the "Proportional Segment Size":

  The "proportional set size" (PSS) of a process is the count of pages it has
  in memory, where each page is divided by the number of processes sharing it.
  So if a process has 1000 pages all to itself, and 1000 shared with one other
  process, its PSS will be 1500.

A web search also finds a tool that uses this information:

In theory, this should give accurate memory usage information, but i
have not checked it extensively.


More information about the samba-technical mailing list