[Python-checkins] python/dist/src/Modules gcmodule.c,2.70,2.71
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 17 Apr 2003 10:29:24 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv2992/Modules
Modified Files:
gcmodule.c
Log Message:
- New C API PyGC_Collect(), same as calling gc.collect().
- Call this in Py_Finalize().
- Expand the Misc/NEWS text on PY_LONG_LONG.
Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.70
retrieving revision 2.71
diff -C2 -d -r2.70 -r2.71
*** gcmodule.c 8 Apr 2003 17:17:17 -0000 2.70
--- gcmodule.c 17 Apr 2003 17:29:21 -0000 2.71
***************
*** 981,986 ****
}
/* for debugging */
! void _PyGC_Dump(PyGC_Head *g)
{
_PyObject_Dump(FROM_GC(g));
--- 981,1004 ----
}
+ /* API to invoke gc.collect() from C */
+ long
+ PyGC_Collect(void)
+ {
+ long n;
+
+ if (collecting)
+ n = 0; /* already collecting, don't do anything */
+ else {
+ collecting = 1;
+ n = collect(NUM_GENERATIONS - 1);
+ collecting = 0;
+ }
+
+ return n;
+ }
+
/* for debugging */
! void
! _PyGC_Dump(PyGC_Head *g)
{
_PyObject_Dump(FROM_GC(g));