Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision 33e9b87058a7891cc24e178aa75354e03171452c)
+++ libcfa/src/heap.cfa	(revision 07b59ec9c09550b0684c5f402f3ba416a28bdbc9)
@@ -10,6 +10,6 @@
 // Created On       : Tue Dec 19 21:58:35 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Dec 30 08:37:37 2022
-// Update Count     : 1605
+// Last Modified On : Fri Jul 28 18:27:53 2023
+// Update Count     : 1612
 //
 
@@ -369,4 +369,5 @@
 static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing
 static __thread Heap * heapManager CALIGN TLSMODEL;
+static  __thread bool heapManagerBootFlag CALIGN TLSMODEL = false;
 static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing
 
@@ -488,4 +489,5 @@
 			allocUnfreed = 0;
 			#endif // __CFA_DEBUG__
+			heapManagerBootFlag = true;
 		} // with
 	} // if
@@ -499,4 +501,6 @@
 
 	lock( heapMaster.mgrLock );							// protect heapMaster counters
+
+	assert( ! heapManagerBootFlag );
 
 	// get storage for heap manager
@@ -514,4 +518,6 @@
 
 void heapManagerDtor() libcfa_public {
+  if ( unlikely( ! heapManagerBootFlag ) ) return;		// thread never used ?
+
 	lock( heapMaster.mgrLock );
 
@@ -526,4 +532,5 @@
 	// Do not set heapManager to NULL because it is used after Cforall is shutdown but before the program shuts down.
 
+	heapManagerBootFlag = false;
 	unlock( heapMaster.mgrLock );
 } // heapManagerDtor
@@ -535,5 +542,5 @@
 extern int cfa_main_returned;							// from interpose.cfa
 extern "C" {
-	void memory_startup( void ) {
+	void memory_startup( void ) {						// singleton => called once at start of program
 		if ( ! heapMasterBootFlag ) heapManagerCtor();	// sanity check
 	} // memory_startup
@@ -895,7 +902,16 @@
 #endif // __STATISTICS__
 
+// Uncomment to get allocation addresses for a 0-sized allocation rather than a null pointer.
+//#define __NONNULL_0_ALLOC__
+#if ! defined( __NONNULL_0_ALLOC__ )
+#define __NULL_0_ALLOC__ unlikely( size == 0 ) ||		/* 0 BYTE ALLOCATION RETURNS NULL POINTER */
+#else
+#define __NULL_0_ALLOC__
+#endif // __NONNULL_0_ALLOC__
+
 #define PROLOG( counter, ... ) \
 	BOOT_HEAP_MANAGER; \
-	if ( unlikely( size == 0 ) ||						/* 0 BYTE ALLOCATION RETURNS NULL POINTER */ \
+	if ( \
+		__NULL_0_ALLOC__ \
 		unlikely( size > ULONG_MAX - sizeof(Heap.Storage) ) ) { /* error check */ \
 		STAT_0_CNT( counter ); \
