@ -131,19 +131,24 @@ public final class BufferUtils {
BufferUtils . cleanupthread . start ( ) ;
}
if ( buffer instanceof ByteBuffer ) {
BufferInfo info = new BufferInfo ( ByteBuffer . class , buffer . capacity ( ) , buffer , BufferUtils . removeCollected ) ;
BufferInfo info = new BufferInfo ( ByteBuffer . class , buffer . capacity ( ) , buffer ,
BufferUtils . removeCollected ) ;
BufferUtils . trackedBuffers . put ( info , info ) ;
} else if ( buffer instanceof FloatBuffer ) {
BufferInfo info = new BufferInfo ( FloatBuffer . class , buffer . capacity ( ) * 4 , buffer , BufferUtils . removeCollected ) ;
BufferInfo info = new BufferInfo ( FloatBuffer . class , buffer . capacity ( ) * 4 , buffer ,
BufferUtils . removeCollected ) ;
BufferUtils . trackedBuffers . put ( info , info ) ;
} else if ( buffer instanceof IntBuffer ) {
BufferInfo info = new BufferInfo ( IntBuffer . class , buffer . capacity ( ) * 4 , buffer , BufferUtils . removeCollected ) ;
BufferInfo info = new BufferInfo ( IntBuffer . class , buffer . capacity ( ) * 4 , buffer ,
BufferUtils . removeCollected ) ;
BufferUtils . trackedBuffers . put ( info , info ) ;
} else if ( buffer instanceof ShortBuffer ) {
BufferInfo info = new BufferInfo ( ShortBuffer . class , buffer . capacity ( ) * 2 , buffer , BufferUtils . removeCollected ) ;
BufferInfo info = new BufferInfo ( ShortBuffer . class , buffer . capacity ( ) * 2 , buffer ,
BufferUtils . removeCollected ) ;
BufferUtils . trackedBuffers . put ( info , info ) ;
} else if ( buffer instanceof DoubleBuffer ) {
BufferInfo info = new BufferInfo ( DoubleBuffer . class , buffer . capacity ( ) * 8 , buffer , BufferUtils . removeCollected ) ;
BufferInfo info = new BufferInfo ( DoubleBuffer . class , buffer . capacity ( ) * 8 , buffer ,
BufferUtils . removeCollected ) ;
BufferUtils . trackedBuffers . put ( info , info ) ;
}
@ -1258,14 +1263,18 @@ public final class BufferUtils {
}
store . append ( "Existing buffers: " ) . append ( BufferUtils . trackedBuffers . size ( ) ) . append ( "\n" ) ;
store . append ( "(b: " ) . append ( bBufs ) . append ( " f: " ) . append ( fBufs ) . append ( " i: " ) . append ( iBufs ) . append ( " s: " ) . append ( sBufs ) . append ( " d: " ) . append ( dBufs ) . append ( ")" ) . append ( "\n" ) ;
store . append ( "(b: " ) . append ( bBufs ) . append ( " f: " ) . append ( fBufs ) . append ( " i: " ) . append ( iBufs )
. append ( " s: " ) . append ( sBufs ) . append ( " d: " ) . append ( dBufs ) . append ( ")" ) . append ( "\n" ) ;
store . append ( "Total heap memory held: " ) . append ( heapMem / 1024 ) . append ( "kb\n" ) ;
store . append ( "Total direct memory held: " ) . append ( totalHeld / 1024 ) . append ( "kb\n" ) ;
store . append ( "(b: " ) . append ( bBufsM / 1024 ) . append ( "kb f: " ) . append ( fBufsM / 1024 ) . append ( "kb i: " ) . append ( iBufsM / 1024 ) . append ( "kb s: " ) . append ( sBufsM / 1024 ) . append ( "kb d: " )
store . append ( "(b: " ) . append ( bBufsM / 1024 ) . append ( "kb f: " ) . append ( fBufsM / 1024 ) . append ( "kb i: " )
. append ( iBufsM / 1024 ) . append ( "kb s: " ) . append ( sBufsM / 1024 ) . append ( "kb d: " )
. append ( dBufsM / 1024 ) . append ( "kb)" ) . append ( "\n" ) ;
} else {
store . append ( "Total heap memory held: " ) . append ( heapMem / 1024 ) . append ( "kb\n" ) ;
store . append ( "Only heap memory available, if you want to monitor direct memory use BufferUtils.setTrackDirectMemoryEnabled(true) during initialization." ) . append ( "\n" ) ;
store . append (
"Only heap memory available, if you want to monitor direct memory use BufferUtils.setTrackDirectMemoryEnabled(true) during initialization." )
. append ( "\n" ) ;
}
if ( printStout ) {
System . out . println ( store . toString ( ) ) ;