[systemd-devel] Journald - heap size

Christian Häßelbarth mail at christianhaesselbarth.de
Wed Aug 20 07:48:24 PDT 2014


> Lennart Poettering <lennart at poettering.net> hat am 20. August 2014 um 15:14
> geschrieben:
>
>
> On Wed, 20.08.14 09:08, Christian Häßelbarth (mail at christianhaesselbarth.de)
> wrote:
>
> > Hi all,
> >
> > I'm using systemd in version 197.
> > I've observed that the heap size of the journald continuously grows.
> >
> > I used "cat /proc/[PID_OF_JOUNALD]/smaps for observing the heap size.
> >
> > Right after starting the heap size is about 772 kB
> >
> > 10041000-10102000 rwxp 00000000 00:00 0 [heap]
> > Size: 772 kB
> > Rss: 652 kB
> > Pss: 652 kB
> > Shared_Clean: 0 kB
> > Shared_Dirty: 0 kB
> > Private_Clean: 0 kB
> > Private_Dirty: 652 kB
> > Referenced: 652 kB
> > Anonymous: 652 kB
> > AnonHugePages: 0 kB
> > Swap: 0 kB
> > KernelPageSize: 4 kB
> > MMUPageSize: 4 kB
> > Locked: 0 kB
> >
> >
> > After 7 days of operation the heap size is about 6272 kB
> >
> > 10041000-10102000 rwxp 00000000 00:00 0 [heap]
> > Size: 6272 kB
> > Rss: 6172 kB
> > Pss: 6172 kB
> > Shared_Clean: 0 kB
> > Shared_Dirty: 0 kB
> > Private_Clean: 0 kB
> > Private_Dirty: 6172 kB
> > Referenced: 6172 kB
> > Anonymous: 6172 kB
> > AnonHugePages: 0 kB
> > Swap: 0 kB
> > KernelPageSize: 4kB
> > MMUPageSize: 4kB
> > Locked: 0 kB
> >
> > My journald.conf is the following
> >
> > [Journal]
> > Storage=none
> > #Compress=yes
> > #Seal=yes
> > #SplitMode=login
> > #RateLimitInterval=10s
> > #RateLimitBurst=200
> > #SystemMaxUse=
> > #SystemKeepFree=
> > #SystemMaxFileSize=
> > #SystemMinFileSize=
> > #RuntimeMaxUse=1M
> > #RuntimeKeepFree=
> > #RuntimeMaxFileSize=
> > #RuntimeMinFileSize=
> > #ForwardToSyslog=yes
> > #ForwardToKMsg=no
> > #ForwardToConsole=no
> > #TTYPath=/dev/console
> > #MaxLevelStore=debug
> > #MaxLevelSyslog=debug
> > #MaxLevelKMsg=notice
> > #MaxLevelConsole=info
> >
> >
> > Is it a known bug in version 197?
>
> We keep a cache of open journal files with state. If we never have
> written to anything we don't have anything open, so we use much less
> memory.
>
> And there's more, for example our hashmaps use an allocation cache,
> which will show up as heap usage.
>
> Just looking at the smaps file isn't really a way to identify leaks. And
> allocation caches are a pretty common thing that always appear as heap
> usage, even though the memory isn't leaked.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat

Thanks for your answer!

I've set the storage option to "none" in my journal.conf, assuming that journald
will drop all data. Is that correct?
I'm using systemd in an embedded device context and I would like to save memory.
I understand your point regarding allocation cache etc.

If I get you right then it is quite normal that journald allocates ~6 MB of
memory.
Is there any configuration option to avoid this high memory usage?  For exampel
with the options storage=yes and SystemMaxUse=1MB ?

Regards
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140820/8fb61755/attachment-0001.html>


More information about the systemd-devel mailing list