java jni 内存,Java JNI:内存分配/分区

When using JNI, does the JNI binary use its own memory, or use part of the memory allocated to the JVM?

Details

When you specify -Xmx1024m as a JVM option, does the JVM allocate all 1024 mb of memory to Java objects?

Does it use part of this for Java objects and part of this for the JNI binary, or does the JNI binary have to use memory in addition to this amount? How does the JVM allocate/ partition/ manage memory use in this scenario?

Related questions:

解决方案

As I discovered first hand when we had a memory leak in some JNI code, the JNI binary uses its own memory within the JVM process outside of any JVM heap space. We were seeing Linux actually kill off the JVM because the JVM as a whole was exceeding 3GB of virtual memory. But we were using -Xmx384m and were only using about 40MB of that on the Java objects side of things, which pretty much proves that JNI uses memory outside of the JVM heap space.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值