[Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.3,1.3.2.1

fdrake@sourceforge.net fdrake@sourceforge.net
Tue, 23 Apr 2002 14:19:57 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27025/lib

Modified Files:
      Tag: release21-maint
	libinspect.tex 
Log Message:
Add text about circular references caused by storing frames in local
variables.  This closes SF bug #543148.


Index: libinspect.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** libinspect.tex	10 Apr 2001 15:12:34 -0000	1.3
--- libinspect.tex	23 Apr 2002 21:19:55 -0000	1.3.2.1
***************
*** 288,289 ****
--- 288,304 ----
    exception.
  \end{funcdesc}
+ 
+ Stackframes stored directly or indirectly in local variables can
+ easily cause reference cycles the garbage collector can't collect,
+ leading to memory leaks.  To avoid this, it's a good idea to
+ explicitly remove the cycle in a \keyword{finally} clause.  For
+ example:
+ 
+ \begin{verbatim}
+ def handle_stackframe_without_leak():
+     frame = inspect.currentframe()
+     try:
+         # do something with the frame
+     finally:
+         del frame
+ \end{verbatim}