[all-commits] [llvm/llvm-project] 02106e: [Symbolize] LRU cache binaries in llvm-symbolizer.
Daniel Thornburgh via All-commits
all-commits at lists.llvm.org
Thu Feb 24 16:32:04 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 02106ec15c2e1e0a94ef66154c48650cfb111126
https://github.com/llvm/llvm-project/commit/02106ec15c2e1e0a94ef66154c48650cfb111126
Author: Daniel Thornburgh <dthorn at google.com>
Date: 2022-02-25 (Fri, 25 Feb 2022)
Changed paths:
M llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
M llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
M llvm/tools/llvm-symbolizer/Opts.td
M llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Log Message:
-----------
[Symbolize] LRU cache binaries in llvm-symbolizer.
This change adds a simple LRU cache to the Symbolize class to put a cap
on llvm-symbolizer memory usage. Previously, the Symbolizer's virtual
memory footprint would grow without bound as additional binaries were
referenced.
I'm putting this out there early for an informal review, since there may be
a dramatically different/better way to go about this. I still need to
figure out a good default constant for the memory cap and benchmark the
implementation against a large symbolization workload. Right now I've
pegged max memory usage at zero for testing purposes, which evicts the whole
cache every time.
Unfortunately, it looks like StringRefs in the returned DI objects can
directly refer to the contents of binaries. Accordingly, the cache
pruning must be explicitly requested by the caller, as the caller must
guarantee that none of the returned objects will be used afterwards.
For llvm-symbolizer this a light burden; symbolization occurs
line-by-line, and the returned objects are discarded after each.
Implementation wise, there are a number of nested caches that depend
on one another. I've implemented a simple Evictor callback system to
allow derived caches to register eviction actions to occur when the
underlying binaries are evicted.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D119784
More information about the All-commits
mailing list