mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-24 02:10:30 -05:00
Some POSIX threads implementations (e.g. FreeBSD's libthr) allocate memory on the heap when pthread_mutex_init() is called. Every call to that function must be accompanied by a corresponding call to pthread_mutex_destroy() or else the memory allocated for the mutex will leak. jemalloc can be used for detecting memory allocations which are not released by a process when it exits. Unfortunately, since jemalloc is also the system allocator on FreeBSD and a special (profiling-enabled) build of jemalloc is required for memory leak detection, this method cannot be used for detecting leaked memory allocated by libthr on a stock FreeBSD installation. However, libthr's behavior can be emulated on any platform by implementing alternative versions of libisc functions for creating and destroying mutexes that allocate memory using malloc() and release it using free(). This enables using jemalloc for detecting missing pthread_mutex_destroy() calls on any platform on which it works reliably. Introduce a new ISC_TRACK_PTHREADS_OBJECTS preprocessor macro, which causes isc_mutex_t structures to be allocated on the heap by isc_mutex_init() and freed by isc_mutex_destroy(). Reuse existing mutex macros (after renaming them appropriately) for other operations. |
||
|---|---|---|
| .. | ||
| bind9 | ||
| dns | ||
| irs | ||
| isc | ||
| isccc | ||
| isccfg | ||
| ns | ||
| .gitignore | ||
| Makefile.am | ||