# \#GC

**URL:** https://discuss.python.org/tag/gc/12.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [Py314t uses 2× memory](https://discuss.python.org/t/py314t-uses-2x-memory/108941)

<div class="topic-metadata">

**Author:** [@weixlu](https://discuss.python.org/u/weixlu)\
**Replies:** 20\
**Last updated:** [September 29, 2026, 3:46am UTC](https://discuss.python.org/t/py314t-uses-2x-memory/108941 "2026-09-29T03:46:19Z")

</div>

I’m migrating BEVFormer (an auto-driving model training framework) from Py3.14 to 3.14t. Functionally it runs, but memory usage (RAM, not GPU memory) on 3.14t is about twice that of 3.14. I’ve run many training epochs an…

---

## [Tkinter: don't deallocate images that are in use](https://discuss.python.org/t/tkinter-dont-deallocate-images-that-are-in-use/106993)

<div class="topic-metadata">

**Author:** [@samo](https://discuss.python.org/u/samo)\
**Replies:** 4\
**Last updated:** [April 16, 2026, 1:48pm UTC](https://discuss.python.org/t/tkinter-dont-deallocate-images-that-are-in-use/106993 "2026-04-16T13:48:57Z")

</div>

tkinter has a weird gotcha: \[…\] Tk will not keep a reference to \[image objects\]. When the last Python reference to the image object is deleted, the image data is deleted as well, and Tk will display an empty box wherev…

---

## [Add a module for monitoring GC statistics](https://discuss.python.org/t/add-a-module-for-monitoring-gc-statistics/106695)

<div class="topic-metadata">

**Author:** [@sergey-miryanov](https://discuss.python.org/u/sergey-miryanov)\
**Replies:** 0\
**Last updated:** [March 26, 2026, 1:11pm UTC](https://discuss.python.org/t/add-a-module-for-monitoring-gc-statistics/106695 "2026-03-26T13:11:55Z")

</div>

We have a get\_stats method in the GC module. It works well, but it has a few drawbacks for my eyes. It displays only a small part of the statistics that have been collected. To get statistics, it should go through the …

---

## [I have created a alternative GC for python it's called VGC no GIL bottleneck](https://discuss.python.org/t/i-have-created-a-alternative-gc-for-python-its-called-vgc-no-gil-bottleneck/104309)

<div class="topic-metadata">

**Author:** [@Abdulla-M](https://discuss.python.org/u/Abdulla-M)\
**Replies:** 54\
**Last updated:** [January 4, 2026, 2:34pm UTC](https://discuss.python.org/t/i-have-created-a-alternative-gc-for-python-its-called-vgc-no-gil-bottleneck/104309 "2026-01-04T14:34:01Z")

</div>

Message: Hi everyone . I’ve developed an alternative garbage collection model for Python called VGC (Virtual Garbage Collector). It completely removes the GIL bottleneck and introduces parallel, zone-based memory manag…

---

## [Elapsed time debugging in gc.c](https://discuss.python.org/t/elapsed-time-debugging-in-gc-c/104396)

<div class="topic-metadata">

**Author:** [@pgdr](https://discuss.python.org/u/pgdr)\
**Replies:** 6\
**Last updated:** [October 21, 2025, 7:45am UTC](https://discuss.python.org/t/elapsed-time-debugging-in-gc-c/104396 "2025-10-21T07:45:21Z")

</div>

In GH-108362: Incremental GC implementation #116206 (@markshannon ), it seems to me that the elapsed time debug information disappeared. This change took effect in Python 3.14. Is it possible to get back that piece of …

---

## [C-API: confusion when to implement GC—docs vs stdlib](https://discuss.python.org/t/c-api-confusion-when-to-implement-gc-docs-vs-stdlib/88791)

<div class="topic-metadata">

**Author:** [@ariebovenberg](https://discuss.python.org/u/ariebovenberg)\
**Replies:** 2\
**Last updated:** [April 18, 2025, 6:57pm UTC](https://discuss.python.org/t/c-api-confusion-when-to-implement-gc-docs-vs-stdlib/88791 "2025-04-18T18:57:27Z")

</div>

I’m currently implementing an extension library for CPython, and I’m a bit confused about when GC support is required. To my understanding, the docs seem at odds with what I see in the stdlib (datetime, for example). Th…

---

## [What are the cases where objects will never be collected?](https://discuss.python.org/t/what-are-the-cases-where-objects-will-never-be-collected/52442)

<div class="topic-metadata">

**Author:** [@shynur](https://discuss.python.org/u/shynur)\
**Replies:** 6\
**Last updated:** [May 2, 2024, 10:10pm UTC](https://discuss.python.org/t/what-are-the-cases-where-objects-will-never-be-collected/52442 "2024-05-02T22:10:00Z")

</div>

My class defines \_\_del\_\_ but it is not called when I delete the object.: You can run gc.collect() to force a collection, but there are pathological cases where objects will never be collected. Does it mean the case s…

---

## [Garbage collection of function context when nested function is returned](https://discuss.python.org/t/garbage-collection-of-function-context-when-nested-function-is-returned/34760)

<div class="topic-metadata">

**Author:** [@caonima](https://discuss.python.org/u/caonima)\
**Replies:** 6\
**Last updated:** [October 3, 2023, 4:53pm UTC](https://discuss.python.org/t/garbage-collection-of-function-context-when-nested-function-is-returned/34760 "2023-10-03T16:53:04Z")

</div>

let’s say we have def a(): massive\_local\_object=... small\_local\_object=... return lambda:small\_local\_object since python is dynamically evaluated, i can’t imagine the garbage collector being smart enough to…

---

## [Generation 2 GC events occur frequently and regularly collecting zero objects](https://discuss.python.org/t/generation-2-gc-events-occur-frequently-and-regularly-collecting-zero-objects/34063)

<div class="topic-metadata">

**Author:** [@rohitsanj](https://discuss.python.org/u/rohitsanj)\
**Replies:** 2\
**Last updated:** [September 19, 2023, 11:02pm UTC](https://discuss.python.org/t/generation-2-gc-events-occur-frequently-and-regularly-collecting-zero-objects/34063 "2023-09-19T23:02:23Z")

</div>

We recently tried tweaking the GC threshold values in our FastAPI server running Python 3.11.5 from the default of (700, 10, 10) to incredibly high values of (100\_000, 500\_000, 1\_000\_000). From the screenshot below showi…

---

## [Removing PyGC\_Head for small objects](https://discuss.python.org/t/removing-pygc-head-for-small-objects/1743)

<div class="topic-metadata">

**Author:** [@nas](https://discuss.python.org/u/nas)\
**Replies:** 17\
**Last updated:** [July 18, 2023, 5:02pm UTC](https://discuss.python.org/t/removing-pygc-head-for-small-objects/1743 "2023-07-18T17:02:52Z")

</div>

Here is an idea I have been toying with since the Python core sprint at Facebook. I don’t know yet if there would be any real advantages but I think it is an interesting idea. The current GC (implemented in gcmodule.c)…

---

## [What's up with garbage-collected asyncio.Task objects?](https://discuss.python.org/t/whats-up-with-garbage-collected-asyncio-task-objects/29686)

<div class="topic-metadata">

**Author:** [@fonini](https://discuss.python.org/u/fonini)\
**Replies:** 12\
**Last updated:** [July 17, 2023, 5:59pm UTC](https://discuss.python.org/t/whats-up-with-garbage-collected-asyncio-task-objects/29686 "2023-07-17T17:59:43Z")

</div>

Anytime I wanted to fire-and-forget a coroutine, I have always used asyncio.create\_task, and ignored the returned Task object. This has always worked fine. I have just seen the warning on the docs for asyncio.create\_tas…

---

## [What is the earliest moment when a Python object is eligible for garbage collection and finalization?](https://discuss.python.org/t/what-is-the-earliest-moment-when-a-python-object-is-eligible-for-garbage-collection-and-finalization/18282)

<div class="topic-metadata">

**Author:** [@felix.s](https://discuss.python.org/u/felix.s)\
**Replies:** 6\
**Last updated:** [August 18, 2022, 9:03am UTC](https://discuss.python.org/t/what-is-the-earliest-moment-when-a-python-object-is-eligible-for-garbage-collection-and-finalization/18282 "2022-08-18T09:03:21Z")

</div>

Take this program: import weakref class Spam: def \_\_init\_\_(self): weakref.finalize(self, lambda: print("finalized")) self.x = 5 def spam(self): print(self.x) Spam().spam() Of course CPython will first prin…

---

## [Weakref'edobjects are discard too enthusiastically - how can I change this?](https://discuss.python.org/t/weakrefedobjects-are-discard-too-enthusiastically-how-can-i-change-this/16103)

<div class="topic-metadata">

**Author:** [@Pootle](https://discuss.python.org/u/Pootle)\
**Replies:** 5\
**Last updated:** [June 1, 2022, 4:04pm UTC](https://discuss.python.org/t/weakrefedobjects-are-discard-too-enthusiastically-how-can-i-change-this/16103 "2022-06-01T16:04:36Z")

</div>

I’m doing analytics on multiple images in parallel (around 100 , then another 100…) If I use standard object references I fill my ram then start swapping which is OK for a while… I do want to access some of the 1st 100 …

---

## [Switching from refcounting to libgc](https://discuss.python.org/t/switching-from-refcounting-to-libgc/1641)

<div class="topic-metadata">

**Author:** [@thomas](https://discuss.python.org/u/thomas)\
**Replies:** 37\
**Last updated:** [April 19, 2020, 6:10pm UTC](https://discuss.python.org/t/switching-from-refcounting-to-libgc/1641 "2020-04-19T18:10:35Z")

</div>

I’ve talked to a couple of people about this at PyCon2019, and there was more interest than I expected, so I figure I should just post this here: I’ve (hackishly, as a proof of concept) replaced refcounting with libgc (…
