[Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2)) (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Thu Dec 29 00:28:38 CET 2005
- Previous message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Next message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andrea Arcangeli wrote:
If there's anybody willing to suggest the files to hook into (the location where the interpreter allocates all anonymous memory) and how to invoke gc.collect() from C, that would help. thanks!
It all happens in Modules/gcmodule.c:_PyObject_GC_Malloc. There are per-generation counters; _PyObject_GC_Malloc increments the generation 0 counter, and PyObject_GC_Del decreases it. The counters of the higher generations are incremented when a lower collection occurs.
One challenge is that PyObject_GC_Del doesn't know how large the memory block is that is being released. So it is difficult to find out how much memory is being released in the collection.
Regards, Martin
- Previous message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Next message: [Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]