内存是由jvm限制的C代码在JNA(或JNI)中分配的(参数-Xmx或体系结构32/64)
也就是说,在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一条的答案是“否” - 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.