开发者

Java Segmentation fault when try to allocate buffer sizes larger than 256 MB

开发者 https://www.devze.com 2023-03-08 15:25 出处:网络
I am using a 64-bit 开发者_开发百科JVM (Oracle), when i try to allocate buffer sizes larger than256 MB it complains and throws a \"segmentation fault\" error. I and allocation direct memory buffers us

I am using a 64-bit 开发者_开发百科JVM (Oracle), when i try to allocate buffer sizes larger than 256 MB it complains and throws a "segmentation fault" error. I and allocation direct memory buffers using java NIO, and transferring and receiving these objects to and from a RMI client program on same machine (Linux 64 bit).

Any idea?


Segmentation Faults happen in programs (such as the JVM) due to memory errors. Either the JVM has a bug in it that makes it try to use the wrong section of memory on the computer when its cranked up to use that much buffer space, or it tries to allocate 256M of memory and in the process it uses more space than the computer gave it. In short, it sounds to me like the 64 bit JVM wasn't built to allocate that much space with its current settings. Perhaps you could try to configure the JVM so that it asks for more memory from the computer before it starts up. jtahlborn's comment on your asking what the max heap setting is on the JVM is also a question you should ask before you run the program again.


Have you tried the following workaround from the bug report?

Run System.gc() before ByteBuffer.allocateDirect()...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号