[jboss-user] [JBoss Messaging] - Re: JBM2 Beta5 with JBAS5.1 - Memory leak SessionContinuatio

simon_temple do-not-reply at jboss.com
Fri Aug 21 05:37:38 EDT 2009


The loop in ClientProducerImpl seems to be responsible:

         while (!lastChunk)
  |          {
  |             byte[] bytesRead = new byte[minLargeMessageSize];
  |             int numberOfBytesRead;
  | 
  |             try
  |             {
  |                numberOfBytesRead = input.read(bytesRead);
  |             }
  |             catch (IOException e)
  |             {
  |                throw new MessagingException(MessagingException.LARGE_MESSAGE_ERROR_BODY,
  |                                             "Error reading the LargeMessageBody",
  |                                             e);
  |             }
  | 
  |             if (numberOfBytesRead < 0)
  |             {
  |                numberOfBytesRead = 0;
  |                lastChunk = true;
  |             }
  | 
  |             final SessionSendContinuationMessage chunk = new SessionSendContinuationMessage(bytesRead,
  |                                                                                             numberOfBytesRead,
  |                                                                                             !lastChunk,
  |                                                                                             lastChunk && sendBlocking);
  | 
  |             if (sendBlocking && lastChunk)
  |             {
  |                // When sending it blocking, only the last chunk will be blocking.               
  |                channel.sendBlocking(chunk);
  |             }
  |             else
  |             {
  |                channel.send(chunk);               
  |             }
  |          }
  | 

By configuring my connection factory I have minLargeMessageSize=131072 (128K)

My input stream is a buffered input stream returning 1024 bytes at a time.

The stream source is 512K in length.

Therefore, each time around the loop I will create a new 128K byte[] with 1K of data read into it.  I then pass a reference to the array to new SessionSendContinuationMessage.

With 512 loop interations required to read and send the stream content I consume 64M of heap space in byte arrays.

wdyt?


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250830#4250830

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250830



More information about the jboss-user mailing list