Python C 模块中的映射 - 有什么需要注意的陷阱吗?

发布于 2024-10-08 11:39:59 字数 91 浏览 0 评论 0原文

我正在用 C 语言编写一个 Python 模块,并且打算映射较大的内存块(也许 500 MB)。在与 Python 解释器相同的进程空间中工作时,有什么我应该注意的吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月亮邮递员 2024-10-15 11:39:59

不,你很好。
在 32 位系统上,您可能会耗尽虚拟内存,或者由于虚拟内存碎片而没有足够大的块来映射所需数量的大文件。但这个陷阱并不是 CPython 特有的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文