0

In simple python CLI script, I created a memory buffer with Byteio and wrote some data there. I call it from the terminal.

Let's say my program is in progress for one hour.

Can python interpreter implicitly move my buffer from one logical memory location to another during program execution?

2
  • 6
    This should not affect your directly, because I think that would be an implementation detail or even an OS decision, not something you as a programmer should need to worry about. Is it just curiosty on your part or are you having some issues with it?
    – Ralf
    Mar 16, 2019 at 11:13
  • I'm just awfully curious :)))
    – Dimitry
    Mar 16, 2019 at 11:58

1 Answer 1

1

No. CPython's garbage collector doesn't do moving or compacting. The reason for that is that it provided direct references to objects to C extensions in the early versions (before 2.0), and move to indirect references or read barriers would break C extension compatibility.

PyPy has a more efficient and advanced moving GC, since it doesn't maintain compatibility with C extensions.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.