内存是由jvm限制的C代码在JNA(或JNI)中分配的(参数-Xmx或体系结构32/64)

发布于 2024-08-26 05:18:37 字数 147 浏览 3 评论 0原文

也就是说,在 C 部分中请求 5 mb 的 malloc() 是否会失败,因为:

  • jvm 是使用 -Xmx32m 运行的,并且 jvm 堆已经是 30 mb
  • 与 64 位 Windows 中的 jvm 为 32 位有关

that is, could a malloc() asking for 5 mb in the C part fail due to:

  • jvm was run with -Xmx32m and jvm heap is already 30 mb
  • something to do with jvm being 32 bits in a 64 bits windows

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

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

发布评论

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

评论(1

拥醉 2024-09-02 05:18:37

第一条的答案是“否” - Xmx 指的是 Java 堆,任何本机分配都是完全独立的。

第二个问题的答案是“是”——本机分配受到操作系统和/或硬件固有的一般进程分配限制。

The answer to the the first bullet is "no" - Xmx refers to the Java heap and any native allocations are completely separate.

The answer to the second bullet is "yes" - native allocations are subject to the general process allocation restrictions inherent in the O/S and/or hardware.

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