mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 00:24:34 +02:00
MemoryDataStore: Enforce min growth step and delay allocation of buffer
This commit is contained in:
parent
63896875d4
commit
67e7b39dfc
@ -11,7 +11,7 @@ public class MemoryDataStore implements DexDataStore {
|
||||
private int size = 0;
|
||||
|
||||
public MemoryDataStore() {
|
||||
this(1024 * 1024);
|
||||
this(0);
|
||||
}
|
||||
|
||||
public MemoryDataStore(int initialCapacity) {
|
||||
@ -65,7 +65,8 @@ public class MemoryDataStore implements DexDataStore {
|
||||
}
|
||||
|
||||
protected int getNewBufferSize(int currentSize, int newMinSize) {
|
||||
return newMinSize + (newMinSize >> 2);
|
||||
final int MIN_GROWTH_STEP = 256 * 1024;
|
||||
return Math.max(newMinSize + (newMinSize >> 2), currentSize + MIN_GROWTH_STEP);
|
||||
}
|
||||
|
||||
@Nonnull @Override public InputStream readAt(final int offset) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user