mirror of https://github.com/apache/poi.git
POI 60140 Prevent unnecessary memory usage -- no need to cache HeapByteBuffer in FileBackedDataSource, thanks to Luis Filipe Nassif for diagnosing this
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7cfaa16489
commit
1265c3a9a7
|
@ -94,6 +94,8 @@ public class FileBackedDataSource extends DataSource {
|
|||
if (writable) {
|
||||
dst = channel.map(FileChannel.MapMode.READ_WRITE, position, length);
|
||||
worked = 0;
|
||||
// remember the buffer for cleanup if necessary
|
||||
buffersToClean.add(dst);
|
||||
} else {
|
||||
// Read
|
||||
channel.position(position);
|
||||
|
@ -109,9 +111,6 @@ public class FileBackedDataSource extends DataSource {
|
|||
// Ready it for reading
|
||||
dst.position(0);
|
||||
|
||||
// remember the buffer for cleanup if necessary
|
||||
buffersToClean.add(dst);
|
||||
|
||||
// All done
|
||||
return dst;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue