Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision 28c2933d61b4b36dbca77aca0b5667d2af33a8ad)
+++ libcfa/src/heap.cfa	(revision a47fe52255f391775719c2fdfc5a98b181a1b7ee)
@@ -10,6 +10,6 @@
 // Created On       : Tue Dec 19 21:58:35 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 28 18:27:53 2023
-// Update Count     : 1612
+// Last Modified On : Wed Aug  2 18:48:30 2023
+// Update Count     : 1614
 //
 
@@ -527,4 +527,5 @@
 
 	#ifdef __STATISTICS__
+	heapMaster.stats += heapManager->stats;				// retain this heap's statistics
 	heapMaster.threads_exited += 1;
 	#endif // __STATISTICS__
@@ -564,4 +565,10 @@
 		fclose( stdin ); fclose( stdout );				// free buffer storage
 	  if ( ! cfa_main_returned ) return;				// do not check unfreed storage if exit called
+
+		#ifdef __STATISTICS__
+		if ( getenv( "CFA_MALLOC_STATS" ) ) {			// check for external printing
+			malloc_stats();
+		} // if
+		#endif // __STATISTICS__
 
 		#ifdef __CFA_DEBUG__
