The GIL acts as a global mutex, ensuring that Python's pervasive reference counting mechanism, which manages memory by tracking object usage, remains consistent and free from corruption, preventing premature object deallocation or memory leaks.
Open the full topic