Files
shadowsocks-libev/scripts/no_heap_baseline.txt
Max Lv ed75faf80f Rewrite the cache on a fixed slab without per-entry allocation
cache.cpp keeps its C API but replaces uthash and the two mallocs per
entry with one slab of nodes holding their keys inline, linked in
last-use order, and an open-addressing index of node ids that hashes
through the slab with a per-cache random seed. Both blocks are reserved
by cache_create() and touched only as entries are used, so a large,
mostly empty cache costs no resident memory.

Semantics are unchanged: an insert evicts the least recently used entry
once the cache holds capacity entries (the AEAD-2022 session table's
4095/4096 boundary), lookups refresh recency and age, cache_clear()
drops stale entries, and free_cb may re-enter the cache. Re-inserting a
key now replaces its data instead of shadowing it. cache_create_keyed()
sizes keys per cache; the AEAD-2022 salt pool and session table use it.

test_cache_cpp covers the boundary, ordering, replacement, ageing,
re-entrant callbacks and limits; alloc_steady_cache requires zero
allocations across 100,000 inserts on a full cache. AEAD-2022 ss-server
drops from 84 to 80 allocations per relayed connection.
2026-10-14 22:53:07 +08:00

26 lines
655 B
Plaintext

# Heap-allocation ratchet for C++ sources converted mechanically from C.
# Format: <path> <violations>. check_no_heap.py fails if a file gains
# violations, and also when it loses some, so the number here always goes
# down. Remove a file once it is rewritten on the src/core primitives.
src/aead.cpp 4
src/aead2022.cpp 3
src/aead2022_udp.cpp 5
src/crypto.cpp 4
src/ipset.cpp 3
src/jconf.cpp 16
src/json.cpp 2
src/local.cpp 16
src/manager.cpp 14
src/plugin.cpp 3
src/process.cpp 26
src/redir.cpp 15
src/resolv.cpp 6
src/rule.cpp 2
src/server.cpp 17
src/ss_event.cpp 5
src/ssurl.cpp 3
src/stream.cpp 3
src/tunnel.cpp 14
src/udprelay.cpp 7
src/utils.cpp 10