[Python-checkins] CVS: python/dist/src/Modules main.c,1.48,1.49

Barry Warsaw bwarsaw@users.sourceforge.net
Fri, 23 Feb 2001 08:46:41 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv19825

Modified Files:
	main.c 
Log Message:
Py_Main(): When compiled by Insure (i.e. __INSURE__ is defined), call
the internal API function to release the interned strings as the very
last thing before returning status.  This aids in memory use debugging
because it eliminates a huge source of noise from the reports.  This
is never called during normal (non-debugging) use because releasing
the interned strings slows Python's shutdown and isn't necessary
anyway because the system will always reclaim the memory.


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** main.c	2001/02/22 00:39:47	1.48
--- main.c	2001/02/23 16:46:39	1.49
***************
*** 302,305 ****
--- 302,319 ----
  
  	Py_Finalize();
+ 
+ #ifdef __INSURE__
+ 	/* Insure++ is a memory analysis tool that aids in discovering
+ 	 * memory leaks and other memory problems.  On Python exit, the
+ 	 * interned string dictionary is flagged as being in use at exit
+ 	 * (which it is).  Under normal circumstances, this is fine because
+ 	 * the memory will be automatically reclaimed by the system.  Under
+ 	 * memory debugging, it's a huge source of useless noise, so we
+ 	 * trade off slower shutdown for less distraction in the memory
+ 	 * reports.  -baw
+ 	 */
+ 	_Py_ReleaseInternedStrings();
+ #endif /* __INSURE__ */
+ 
  	return sts;
  }