# LSan suppressions for NeoGraph's sanitizer-test CI gate.
#
# These libraries either intentionally leak per-process state (e.g.
# OpenSSL's algorithm tables) or do reachable allocations that LSan
# flags as "still reachable" at exit. None of these are NeoGraph code.
# If you find yourself adding a NeoGraph symbol to this file, that's a
# real bug — fix the leak in NeoGraph, don't suppress.
#
# Format: `leak:<symbol_substring>` — applied to any allocation whose
# stack contains a frame whose mangled name matches the substring.

# OpenSSL — algorithm tables, error queue per-thread, lazy ENGINE init.
# These persist for the life of the process by design.
leak:CRYPTO_zalloc
leak:OPENSSL_init_crypto
leak:OPENSSL_LH_insert
leak:ERR_load_strings
leak:ENGINE_load_

# libcurl — DNS cache + alt-svc + cookie engine pre-allocations that
# never get released because curl is treated as a process singleton.
leak:Curl_resolv
leak:Curl_share_init
leak:Curl_init_userdefined

# libstdc++ ABI — the demangler caches symbol tables in TLS that
# isn't released on dlclose.
leak:__cxa_get_globals
leak:__cxa_demangle

# Unwinder & exception machinery (libgcc/libstdc++ runtime).
leak:_Unwind_

# pthread thread-local storage — TLS blocks are released on thread
# exit, but if a worker thread is alive at process exit, LSan treats
# its TLS as a leak. Engine thread pools shut down before exit, but
# detached io_context threads occasionally outlive the cleanup.
leak:__tls_get_addr

# libpq — connection-cache + per-connection state caches that PG's
# C client treats as process-global. Cleared by PQfinish / atexit
# on most paths but LSan racing with atexit reports them.
leak:PQconnectStart
leak:PQconnectdb
leak:pgthreadlock
leak:pq_initstack

# libpqxx — connection-pool internal caches and prepared-statement
# tables. Lifetime tied to neograph::graph::PostgresCheckpointStore
# which destructs cleanly, but residual state from libpqxx itself
# pre-allocates per-process tables.
leak:pqxx::connection

# CPython interpreter — PyObject_Malloc, PyType creation, module
# import caches. Python intentionally leaks these for the process
# lifetime because they're amortized over the whole program. Only
# triggered when running the Python pytest suite under ASan via
# LD_PRELOAD=libasan.so.
leak:PyObject_Malloc
leak:PyImport_ImportModuleLevelObject
leak:_PyObject_GenericSetAttrWithDict
leak:PyType_Ready
leak:_PyEval_EvalFrameDefault
leak:_PyType_AllocNoTrack
leak:_PyMem_RawMalloc

# pybind11 — class binding init creates Python type objects that
# live for the process lifetime (one per `py::class_<T>` declaration).
# Counts as still-reachable, not a NeoGraph leak.
leak:pybind11::detail::make_new_python_type
leak:pybind11::detail::generic_type::initialize
leak:pybind11::class_
leak:pybind11_meta_setattro
leak:pybind11::setattr

# pydantic-core — Rust-built C extension with its own static caches.
# Pulled in transitively by some test deps (e.g. anyio, langsmith,
# pydantic). Not NeoGraph code.
leak:_pydantic_core
leak:pydantic_core

# certifi / cryptography pre-allocated module-level constants.
leak:certifi
leak:cryptography
