0

Can I disable Python dynamic garbage collection?

If so, how would one go about accomplishing this goal?

Thank you for insights and guidance.

2
  • 1
    The documentation for the module gc outlines this. Note though that this is not usually a good idea unless you can guarantee that you won't have any reference cycles. Commented Aug 26, 2022 at 2:50
  • Understood. I'll probably totally mess it up... Thanks a ton for the feedback... Needing to try to get Python looking like a compiled language for safety critical purposes, so giving it a go. Thanks. Commented Aug 26, 2022 at 2:58

1 Answer 1

3

To disable garbage collection, you can use the gc module

import gc
gc.disable()

To re-enable it, use

gc.enable()

Documentation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.