[collectd] collectd uses a lot of virtual memory

Florian Forster octo at verplant.org
Fri Aug 28 10:15:01 CEST 2009


Hi Christoffer,

On Thu, Aug 27, 2009 at 10:02:52PM +0200, Christoffer Sawicki wrote:
> VSZ is 67952 which seems a lot to me. Is this normal? Is there anyway
> I can lower it (perhaps by using more lazy memory allocation)? I care
> about the amount of allocated memory (and not only used memory) since
> it is counted against my VPS quota.

yes, this is expected and known behavior: collectd uses a lot of
threads, which need a (fixed size) stack each. On my Linux system the
default stack size for threads is 8 MBytes. Since there are at least
6 threads in the default configuration, you'd end up with 48+ MBytes of
virtual memory. 68 MBytes doesn't seem to be far off.

Usually this is not a problem, even vor embedded systems, because Linux
does overcommitting by default. If this is not an option or, as in your
case, virtual memory size is limited (why, by the way?), you'll have to
reduce the stack size for new threads. You can do that by setting the
appropriate ulimit prior to starting collectd, for example in the init-
script or (under Debian) in /etc/default/collectd. The command would
look somewhat like this:

  # Set soft stack limit to 512 kBytes
  $ ulimit -S -s 512

I can't probmise 512 kBytes to be enough for every configuration, but I
think it should for in most cases. You might even be able to go lower.

HTH, regards,
—octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090828/7d32efda/attachment.pgp 


More information about the collectd mailing list