Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21327#discussion_r188689311
--- Diff:
core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer.scala ---
@@ -63,15 +63,18 @@ private[spark] class ChunkedByteBuffer(var chunks:
Array[ByteBuffer]) {
*/
def writeFully(channel: WritableByteChannel): Unit = {
for (bytes <- getChunks()) {
- val curChunkLimit = bytes.limit()
+ val originalLimit = bytes.limit()
while (bytes.hasRemaining) {
- try {
- val ioSize = Math.min(bytes.remaining(), bufferWriteChunkSize)
- bytes.limit(bytes.position() + ioSize)
- channel.write(bytes)
- } finally {
- bytes.limit(curChunkLimit)
- }
+ // If `bytes` is an on-heap ByteBuffer, the JDK will copy it to a
temporary direct
--- End diff --
the caching happens in the JDK code, not some magic inside JVM.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]