Skip to main content

disable_gc

Python context manager for temporarily disabling the garbage collector.

Reentrant, threadsafe, safe for use in asyncio, and prevents GC starvation.

Safe for use inside finalizers.

Usage

from disable_gc import disable_gc
with disable_gc:
    a = 1 # Doing things with GC disabled

@disable_gc
def func():
    a = 1  # GC disabled inside the function.

Notes

disable_gc does not and cannot monkey patch gc.enable(). Other threads enabling the gc in the background will leave it enabled until disable_gc is reentered once again.

Can be used as a reference for bpo-31356.

Release files for disable-gc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for disable-gc 0.1.0
File Interpreter ABI Platform
disable_gc-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / disable_gc-0.1.0-py3-none-any.whl

Download URL disable_gc-0.1.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f504e712751b0f2054ac5c638ea090c8190ec1858e877c691dc4554970fd3b64
BLAKE2b-256 checksum
How to use checksums
3a80ab63ea1acd544f0ffb74b64cf850655ce5847093f323a55b3d7ed3f08688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page