diff options
author | Guido van Rossum <guido@python.org> | 2003-04-17 17:29:22 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-17 17:29:22 (GMT) |
commit | e13ddc9ec85287b17fd03454f836f495c1167de9 (patch) | |
tree | 20de9aa63915e14e39d87fc7a4e88a39c9eb03c7 /Modules | |
parent | cf8d285ba321dcb1c479a16d15e0224b3ad05970 (diff) | |
download | cpython-e13ddc9ec85287b17fd03454f836f495c1167de9.zip cpython-e13ddc9ec85287b17fd03454f836f495c1167de9.tar.gz cpython-e13ddc9ec85287b17fd03454f836f495c1167de9.tar.bz2 |
- New C API PyGC_Collect(), same as calling gc.collect().
- Call this in Py_Finalize().
- Expand the Misc/NEWS text on PY_LONG_LONG.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/gcmodule.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 4fd4027..bb40b8f 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -980,8 +980,26 @@ initgc(void) #undef ADD_INT } +/* 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) +void +_PyGC_Dump(PyGC_Head *g) { _PyObject_Dump(FROM_GC(g)); } |