This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Excessive memory usage by associative arrays


Hello!

OS: CentOS 7.0 with stock kernel
SystemTap: 2.4

I created script that contains plenty of associative arrays and
statistics. OOM Killer kills stapio even before module is initialized.
I've added debug print to a _stp_map_new and noticed that it
allocation is really huge:

- By default MAXMAPENTRIES is 2048
- Each string is stored statically and MAP_STRING_LENGTH is 256 (i
have 2 keys so its 256)
- Plus statistics data gives us 1088 bytes per entry
- SystemTap initializes map on per-cpu basis and do it with
for_each_possible_cpu() (128 in my case)

So this simple script:
stap -e ' global a;
     probe timer.s(1) {
             a["aaaa", "bbbb"] <<< 1;
     }
     probe timer.s(60) {
             println(@count(a["aaaa", "bbbb"]));
     }'
would eat about 300 Mb of memory.

Of course, I may reduce MAXMAPENTRIES, but I think there is something
wrong with such greedy allocation...
For the record, similiar DTrace script works perfectly (after I
removed leak of records :) ).

Thanks in advance.
BR, Sergey.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]