[issue31105] Cyclic GC threshold may need tweaks

2017-08-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > As a fast approximation the default implementation of the __sizeof__ method > can be used This doesn't handle further resizing of containers, though. -- ___ Python tracker

[issue31105] Cyclic GC threshold may need tweaks

2017-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is an existing protocol for estimating the size of allocated memory. __sizeof__. Python API sys.getsizeof() and C API _PySys_GetSizeOf(). But it is too heavy for using in GC. As a fast approximation the default implementation of the __sizeof__ method

[issue31105] Cyclic GC threshold may need tweaks

2017-08-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yes, this is a potentially annoying limitation of the current scheme. Note that it's not obvious how to proceed for resizable objects such as lists. Should the list inform the GC of every internal resizing? May a list resize trigger a GC run? Also, a small

[issue31105] Cyclic GC threshold may need tweaks

2017-08-02 Thread Armin Rigo
New submission from Armin Rigo: The cyclic GC uses a simple and somewhat naive policy to know when it must run. It is based on counting "+1" for every call to _PyObject_GC_Alloc(). Explicit calls to PyObject_GC_Del() are counted as "-1". The cyclic GC will only be executed after the count