Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

disable_gc-0.1.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page