KiCad PCB EDA Suite
Loading...
Searching...
No Matches
leak_at_exit.h File Reference

Utilities for intentionally "leaking" memory at program exit. More...

#include <mutex>

Go to the source code of this file.

Classes

class  LEAK_AT_EXIT< T >
 A wrapper for static data that should not be destroyed at program exit. More...
 

Macros

#define LSAN_IGNORE(ptr)
 

Detailed Description

Utilities for intentionally "leaking" memory at program exit.

When a program exits, the OS reclaims all process memory anyway. Running destructors that only free memory is wasted work that slows down shutdown. This is especially noticeable for large caches like library symbol/footprint data structures with deep object hierarchies.

When built with address sanitizer (KICAD_SANITIZE_ADDRESS), these utilities use __lsan_ignore_object() to mark the memory as intentionally leaked, preventing false positive leak reports.

Definition in file leak_at_exit.h.

Macro Definition Documentation

◆ LSAN_IGNORE

#define LSAN_IGNORE ( ptr)
Value:
(void)( ptr )

Definition at line 43 of file leak_at_exit.h.

Referenced by LEAK_AT_EXIT< T >::Get().