2 Replies Latest reply on Aug 9, 2012 11:59 AM by clebert.suconic

    Why do NIOSequentialFile and NIOSequentialFileFactory use ByteBuffer.allocate() instead of ByteBuffer.allocateDirect()?

    rdelfino

      Hi;

       

      I've been using HornetQ embedded for a while in a software solution we developed.

       

      This week we were bitten hardly by an OutOfMemory error that occured on NIOSequentialFile

      when HornetQ tried to create a new journal file. After that error the application could

      no more send messages to the queues and all hell broke loose.

       

      Browsing HornetQ source code to understand the error I would like to know why

      NIOSequentialFile and NIOSequentialFileFactory use ByteBuffer.allocate() instead

      of ByteBuffer.allocateDirect()?

       

      If ByteBuffer.allocateDirect() was used instead the journal would not compete with

      the rest of the application code for JVM heap space and this error could be avoided.

       

      I know we should be monitoring memory usage and also that we should have tunned

      Xmx parameters, and so on, however I couldn't help ask you guys.

       

      Thanks in advance

       

      Reginaldo