Skip to content

Commit d8b225d

Browse files
committed
Fixed #539 (max recyclable chunk length reduction)
1 parent 11e128e commit d8b225d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

release-notes/VERSION-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ JSON library.
3131
#508: Add new exception type `InputCoercionException` to be used for failed coercions
3232
like overflow for `int`
3333
#527: Add simple module-info for JDK9+, using Moditect
34+
#539: Reduce max size of recycled byte[]/char[] blocks by `TextBuffer`, `ByteArrayBuilder`
3435

3536
2.9.9 (16-May-2019)
3637

src/main/java/com/fasterxml/jackson/core/util/ByteArrayBuilder.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public final class ByteArrayBuilder extends OutputStream
3333
// Size of the first block we will allocate.
3434
private final static int INITIAL_BLOCK_SIZE = 500;
3535

36-
// Maximum block size we will use for individual non-aggregated
37-
// blocks. Let's limit to using 256k chunks.
38-
private final static int MAX_BLOCK_SIZE = (1 << 18);
39-
36+
// Maximum block size we will use for individual non-aggregated blocks.
37+
// For 2.10, let's limit to using 128k chunks (was 256k up to 2.9)
38+
private final static int MAX_BLOCK_SIZE = (1 << 17);
39+
4040
final static int DEFAULT_BLOCK_ARRAY_SIZE = 40;
4141

4242
// Optional buffer recycler instance that we can use for allocating the first block.

src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public final class TextBuffer
3434
final static int MIN_SEGMENT_LEN = 1000;
3535

3636
/**
37-
* Let's limit maximum segment length to something sensible
38-
* like 256k
37+
* Let's limit maximum segment length to something sensible.
38+
* For 2.10, let's limit to using 64kc chunks (128 kB) -- was 256kC/512kB up to 2.9
3939
*/
40-
final static int MAX_SEGMENT_LEN = 0x40000;
40+
final static int MAX_SEGMENT_LEN = 0x10000;
4141

4242
/*
4343
/**********************************************************

0 commit comments

Comments
 (0)