Excessive memory usage by associative arrays

Frank Ch. Eigler fche@redhat.com
Mon Jan 19 20:08:00 GMT 2015


Sergey Klyaus <myautneko@gmail.com> writes:

> [...]
> - 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)

Yes, unfortunately all those factors multiply.  You can control
MAXMAPENTRIES and MAXSTRINGLEN directly via -D options or other ways.
How many CPUs does your machine actually have?

See also
https://sourceware.org/systemtap/wiki/TipExhaustedResourceErrors 


> Of course, I may reduce MAXMAPENTRIES, but I think there is
> something wrong with such greedy allocation...

Its purpose is to ensure that no dynamic memory allocation occurs
during runtime, so is a safety measure.


> For the record, similiar DTrace script works perfectly (after I
> removed leak of records :) ).

Understood, though their situation is much simpler, and that toy
script can be made to work on stap in many ways.


- FChE



More information about the Systemtap mailing list