Implementation:ClickHouse ClickHouse Phdr Cache
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Performance, System |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Caches ELF program headers to improve performance of dl_iterate_phdr calls.
Description
Intercepts dl_iterate_phdr and caches results to avoid repeated kernel calls. Significantly speeds up operations like stack unwinding in exception handling.
Usage
Use in performance-critical code that frequently calls dl_iterate_phdr, like exception handling or stack tracing.
Code Reference
Source Location
- Repository: ClickHouse
- File: base/base/phdr_cache.cpp
- Lines: 1-126
Signature
void updatePHDRCache();
bool hasPHDRCache();
// Intercepted function
extern "C" int dl_iterate_phdr(
int (*callback)(dl_phdr_info * info, size_t size, void * data),
void * data);
Import
// Automatically linked
Usage Examples
// Called once at startup
updatePHDRCache();
// All subsequent dl_iterate_phdr calls use cache
dl_iterate_phdr([](dl_phdr_info* info, size_t, void*) {
// Fast cached iteration
return 0;
}, nullptr);
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment