Search code examples
pythoncmmapcpythonmemory-mapping

mmapping in Python C modules - any pitfalls to be aware of?


I'm writing a Python module in C and I intend to mmap largeish blocks of memory (perhaps 500 MB). Is there anything about working in the same process space as the Python interpreter that I should be careful of?


Solution

  • No, you're fine. On 32-bit systems, you could run out of virtual memory, or with virtual memory fragmentation not have a single chunk big enough to map as many huge files as you want. But that pitfall isn't particular to CPython.