Files
Seth Hillbrand ca7259ab95 Add LEAK_AT_EXIT wrapper to skip destructor calls at program exit
GlobalLibraries and PreloadedFootprints each have deep object
hierarchies that take noticeable time to destroy during shutdown.
Since the OS reclaims all process memory anyway, running these
destructors is wasted work. The new LEAK_AT_EXIT template wrapper
heap-allocates the wrapped object on first access and never frees it,
speeding up program exit.

When built with address sanitizer, it uses __lsan_ignore_object to
prevent false positive leak reports.  Also added a valgrind
suppression file for the same purpose.
2026-01-23 17:26:37 -08:00

50 lines
1.4 KiB
Plaintext

# Valgrind suppression file for KiCad
#
# Usage: valgrind --suppressions=tools/valgrind.supp ./build/bin/kicad
#
# These suppressions address intentional memory leaks and known issues
# in external libraries.
# Intentional memory leaks at shutdown for faster exit
# The GlobalLibraries maps in library adapters are intentionally leaked at
# exit using LEAK_AT_EXIT<> wrapper. The OS reclaims all process memory
# anyway, so skipping these destructors speeds up shutdown significantly.
# See include/core/leak_at_exit.h for details.
{
SYMBOL_LIBRARY_ADAPTER_GlobalLibraries_intentional_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:*SYMBOL_LIBRARY_ADAPTER*GlobalLibraries*
}
{
FOOTPRINT_LIBRARY_ADAPTER_GlobalLibraries_intentional_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:*FOOTPRINT_LIBRARY_ADAPTER*GlobalLibraries*
}
{
FOOTPRINT_LIBRARY_ADAPTER_PreloadedFootprints_intentional_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:*FOOTPRINT_LIBRARY_ADAPTER*PreloadedFootprints*
}
{
DESIGN_BLOCK_LIBRARY_ADAPTER_GlobalLibraries_intentional_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:*DESIGN_BLOCK_LIBRARY_ADAPTER*GlobalLibraries*
}
# Alternative pattern matching for LEAK_AT_EXIT wrapper
{
LEAK_AT_EXIT_intentional_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:*LEAK_AT_EXIT*Get*
}