Trustin Lee
0fc66a411f
The default buffer must be unpooled for backward compatibility
...
Mistakenly set to pooled while merging the changes from 4.1 and master.
2014-02-21 14:43:07 -08:00
Trustin Lee
b18c8fe688
Determine the default allocator from system property
...
- Add ByteBufAllocator.DEFAULT
- The default allocator is 'unpooled'
2014-02-14 13:05:57 -08:00
Norman Maurer
f23d68b42f
[ #2187 ] Always do a volatile read on the refCnt
2014-02-07 09:23:16 +01:00
Norman Maurer
9bee78f91c
Provide an optimized AtomicIntegerFieldUpdater, AtomicLongFieldUpdater and AtomicReferenceFieldUpdater
2014-02-06 20:08:45 +01:00
Norman Maurer
b3d8c81557
Fix all leaks reported during tests
...
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:44:56 +09:00
Trustin Lee
2102cb062b
Fix false-positive leaks
...
- All derived buffers and swapped buffers of a leak-aware buffer must be wrapped again with the leak-aware buffer
2013-12-06 21:32:56 +09:00
Trustin Lee
e506581eb1
Add ReferenceCountUtil.releaseLater() to make writing tests easy with ReferenceCounteds
2013-12-06 15:13:00 +09:00
Trustin Lee
128c4b96b5
Checkstyle
2013-12-06 13:54:36 +09:00
Trustin Lee
5d39b1fc3d
Also record retain() and release()
2013-12-06 13:45:24 +09:00
Trustin Lee
e88172495a
Ensure backward compatibility
...
.. by resurrecting the removed methods and system properties.
2013-12-05 01:02:38 +09:00
Trustin Lee
65b522a2a7
Better buffer leak reporting
...
- Remove the reference to ResourceLeak from the buffer implementations
and use wrappers instead:
- SimpleLeakAwareByteBuf and AdvancedLeakAwareByteBuf
- It is now allocator's responsibility to create a leak-aware buffer.
- Added AbstractByteBufAllocator.toLeakAwareBuffer() for easier
implementation
- Add WrappedByteBuf to reduce duplication between *LeakAwareByteBuf and
UnreleasableByteBuf
- Raise the level of leak reports to ERROR - because it will break the
app eventually
- Replace enabled/disabled property with the leak detection level
- Only print stack trace when level is ADVANCED or above to avoid user
confusion
- Add the 'leak' build profile, which enables highly detailed leak
reporting during the build
- Remove ResourceLeakException which is unsed anymore
2013-12-05 00:51:39 +09:00
Norman Maurer
053c512f6d
Fix checkstyle
2013-12-02 08:23:57 +01:00
Norman Maurer
14600167d6
[ #2021 ] No need to synchronize for unpooled chunks
2013-12-02 08:02:48 +01:00
Norman Maurer
7231be592a
Also allow to override how direct ByteBuffers are freed
2013-11-12 12:40:41 +01:00
Norman Maurer
e83fb821d5
Allow to override how wrapped direct ByteBuffer are allocated to make it easier to extend
2013-11-12 12:13:38 +01:00
Norman Maurer
b00f8c6390
[ #1976 ] Fix IndexOutOfBoundsException when calling CompositeByteBuf.discardReadComponents()
2013-11-09 20:13:24 +01:00
Alex Petrov
e4f391f626
Improve docstrings for and of
2013-11-08 12:15:41 +01:00
Trustin Lee
ba3bc0c020
Simpler toString() for ByteBufAllocators
2013-11-08 17:54:34 +09:00
Norman Maurer
77b4ec7e1b
[ #1800 ] [ #1802 ] Correctly expand capacity of ByteBuf while preserve content
2013-11-04 15:18:21 +01:00
Trustin Lee
54db9ec725
Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
...
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2013-11-04 19:46:15 +09:00
Norman Maurer
4ce49a6195
[ #1943 ] Unpooled.copiedBuffer(ByteBuf pooled) should always return unpooled ByteBuf
2013-10-22 20:20:38 +02:00
Norman Maurer
68b616728a
[ #1925 ] Only expose sub-region of ByteBuf on nioBuffer(...)
2013-10-16 10:34:33 +02:00
Norman Maurer
d946659520
[ #1906 ] Use a ByteBuf allocator from the ByteBufAllocator when encode Strings
2013-10-09 21:18:08 +02:00
Norman Maurer
1c73be21fc
Remove redundant index check
2013-10-08 07:21:01 +02:00
Bill Gallagher
8f612660b2
disable debugging output during test
2013-10-04 06:45:26 +02:00
Norman Maurer
ee192f0321
[ #1880 ] Use ByteBufAllocator when read bytes into new chunks
2013-10-01 10:10:43 +02:00
Norman Maurer
6d09e57be7
[ #1875 ] Correctly check the readerIndex when try to read a byte from AbstractByteBuf
2013-09-30 14:47:49 +02:00
Norman Maurer
b4fa8af079
Cache underlying ByteBuffers and count in ChannelOutboundBuffer.Entry to reduce object creation and so GC pressure
...
Beside this it also helps to reduce CPU usage as nioBufferCount() is quite expensive when used on CompositeByteBuf which are
nested and contains a lot of components
2013-09-26 20:37:39 +02:00
Norman Maurer
2b9a07cac9
CompositeByteBuf.isDirect() should return true if its only backed by direct buffers
2013-09-26 20:37:31 +02:00
Norman Maurer
a74149e984
[ #1865 ] Only use internalNioBuffer when one of the read* or write* methods are used. This is neccessary to prevent races as those can happen when a slice or duplicate is shared between different Channels
...
that are not assigned to the same EventLoop. In general get* operations should always be safe to be used from different Threads.
This aslo include unit tests that show the issue
2013-09-25 17:27:26 +02:00
Norman Maurer
910ed31a1b
[ #1851 ] EmptyByteBuf.isWritable(..) and isReadable(...) should not throw IndexOutOfBoundsException
2013-09-21 20:40:22 +02:00
Norman Maurer
23baef8fb4
[ #1853 ] Optimize gathering writes for CompositeByteBuf that are only backed by one ByteBuffer
2013-09-19 07:29:58 +02:00
Norman Maurer
c0bbde48b7
[ #1852 ] Fix bug in UnpooledDirectByteBuf.nioBuffer(...) implementation
2013-09-18 20:47:57 +02:00
Greg Soltis
f1d4f813ed
Fix nioBuffer implementation for CompositeByteBuf
2013-09-16 06:41:08 +02:00
Norman Maurer
451e91d142
[ #1821 ] Fix IndexOutOfBoundsException which was thrown if the last component was removed but other components was left
2013-09-09 20:29:30 +02:00
Norman Maurer
25c226a835
Make sure only direct ByteBuffer are passed to the underlying jdk Channel.
...
This is needed because of otherwise the JDK itself will do an extra ByteBuffer copy with it's own pool implementation. Even worth it will be done
multiple times if the ByteBuffer is always only partial written. With this change the copy is done inside of netty using it's own allocator and
only be done one time in all cases.
2013-09-02 20:17:53 +02:00
Norman Maurer
5416f2315e
[ #1797 ] No use internalNioBuffer() in derived buffers as it is not meant for concurrent access
2013-09-02 14:15:19 +02:00
Norman Maurer
0007fb81ef
Add tests to try to track down some buffer issues
2013-09-02 13:50:47 +02:00
Norman Maurer
795182843d
Remove legancy code which we not need anymore as we use gathering writes anyway everywhere
2013-09-01 11:00:58 +02:00
Norman Maurer
5ddd7cee90
[ #1797 ] Throw IllegalArgumentException if AbstractByteBuf.skipBytes(...) is used with a negative value
2013-08-29 11:14:36 +02:00
Trustin Lee
20894bc99e
Fix a bug in internalNioBuffer() implementations of derived buffers
...
- A user can create multiple duplicates of a buffer and access their internal NIO buffers. (e.g. write multiple duplicates to multiple channels assigned to different event loop.) Because the derived buffers' internalNioBuffer() simply delegates the call to the original buffer, all derived buffers and the original buffer's internalNioBuffer() will return the same buffer, which will lead to a race condition.
- Fixes #1739
2013-08-20 14:28:50 +09:00
bgallagher
9f88552f12
remove some dead code
2013-08-10 20:46:48 +02:00
Norman Maurer
194b64cff1
[ #1708 ] Correctly set the writerIndex in ReadOnlyByteBufferBuf if it is constructed with a buffer which has non zero position
2013-08-08 06:54:32 +02:00
Norman Maurer
ea1dca8105
[ #1704 ] Make sure SwappedByteBuf.readSlice(..) returns ByteBuf with correct ByteOrder
2013-08-06 12:22:22 +02:00
Norman Maurer
8a673db92b
[ #1644 ] Fixed IndexOutOfBoundException when calling copy() on a empty CompositeByteBuf
2013-07-24 07:35:51 +02:00
Trustin Lee
764741c5ce
Change the contract of ResourceLeakDetector.open() so that unsampled resources are recycled
...
- This also fixes the problem introduced while trying to implement #1612 (Allow to disable resource leak detection).
2013-07-23 14:06:58 +09:00
Norman Maurer
35802207e1
Fix compile error
2013-07-23 06:42:41 +02:00
kerr
ada07cb9e0
Fix types in javadocs
2013-07-22 19:14:36 +02:00
Norman Maurer
f478fcd3b0
[ #1628 ] Fix bug in ReadOnlyByteByteBufferBuf where get operations threw ReadOnlyBufferException
2013-07-22 07:12:05 +02:00
Norman Maurer
feb8d101bd
[ #1626 ] Use static fields for default values
2013-07-22 06:47:29 +02:00