[PATCH] D119784: [Symbolize] LRU cache binaries in llvm-symbolizer.

Daniel Thornburgh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 14:34:25 PST 2022


mysterymath created this revision.
Herald added subscribers: rupprecht, hiraditya.
Herald added a reviewer: jhenderson.
mysterymath updated this revision to Diff 408619.
mysterymath added a comment.
mysterymath updated this revision to Diff 408620.
mysterymath edited the summary of this revision.
mysterymath edited the summary of this revision.
mysterymath edited the summary of this revision.
mysterymath added reviewers: phosek, dblaikie.
mysterymath edited the summary of this revision.
mysterymath edited the summary of this revision.
mysterymath updated this revision to Diff 408625.
mysterymath edited the summary of this revision.
mysterymath published this revision for review.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Clang format.


mysterymath added a comment.

Update commit msg.


mysterymath added a comment.

Fix unnecessary diff.


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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119784

Files:
  llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
  llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119784.408625.patch
Type: text/x-patch
Size: 8754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/fb752240/attachment.bin>


More information about the llvm-commits mailing list