How common are allocation failures
How common are allocation failures
Posted Apr 26, 2026 14:14 UTC (Sun) by devdanzin (subscriber, #183390)In reply to: How common are allocation failures by devdanzin
Parent article: Using LLMs to find Python C-extension bugs
- https://discuss.python.org/t/memoryerror-despite-having-e..., where it's shown a case that raises `MemoryError` despite it looking like the array should fit in RAM.
- https://github.com/msgpack/msgpack-python/issues/239, a real world issue on VMs with low memory amounts resulting in wrong tracebacks.
- https://github.com/gmpy2/gmpy2/issues/280, where GMP aborts on memory error and the user would like to be able to catch an exception instead.
- https://blog.stackademic.com/python-in-production-the-15-..., where a recoverable pandas `MemoryError` brought everythong down.
- https://medium.com/@ryan_forrester_/understanding-and-fix..., showing examples of handling `MemoryError` and a plausible situation.
- https://medium.com/brexeng/debugging-and-preventing-memor..., an interesting article giving an enhanced way of handling `MemoryError`.
- https://pythonspeed.com/articles/python-out-of-memory/ shows how easy it is to get a segfault on an OOM that should be easily recoverable.
- https://discuss.python.org/t/how-must-we-handle-integer-o..., where it's pointed that `string = "a" * 9223372036854775807` raises a `MemoryError`
- https://discuss.python.org/t/trying-to-understand-roundin..., where it's pointed that `import decimal; decimal.getcontext().prec = decimal.MAX_PREC; decimal.Decimal(1) / 3` raises a `MemoryError`
- https://discuss.python.org/t/faster-large-integer-multipl..., where Tim Peters show that `x = 1 << 1000000000000` raises a recoverable `MemoryError`, unlike GMP.
- https://discuss.python.org/t/a-product-function-which-sup..., where it's pointed that `from itertools import product; next(product(range(1 << 30), repeat=2))` causes a real `MemoryError` (exhausts memory in the system), but it's recoverable if not OOM terminated.
