This content has been marked as final.
Show 2 replies
-
1. Re: Why do NIOSequentialFile and NIOSequentialFileFactory use ByteBuffer.allocate() instead of ByteBuffer.allocateDirect()?
jbertram Jul 25, 2012 11:31 AM (in response to rdelfino)I can't speak for Clebert, but I believe allocate() is used because allocateDirect() is slower in general and it is assumed that users will have their memory configured in such a way as to avoid OutOfMemoryErrors.
-
2. Re: Why do NIOSequentialFile and NIOSequentialFileFactory use ByteBuffer.allocate() instead of ByteBuffer.allocateDirect()?
clebert.suconic Aug 9, 2012 11:59 AM (in response to rdelfino)You should have used the user's forum instead.. I will move this message.
allocateDirect is only used when required. There are users with allocateDirect exactly for what you said. GC won't take care of these buffers as they are not holding any reference, and you may get worse OMEs if we were doing this way. Another reason is performance.. allocateDirect is really slow.