mirror of
https://github.com/revanced/smali.git
synced 2025-05-07 18:04:32 +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;
|
private int size = 0;
|
||||||
|
|
||||||
public MemoryDataStore() {
|
public MemoryDataStore() {
|
||||||
this(1024 * 1024);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemoryDataStore(int initialCapacity) {
|
public MemoryDataStore(int initialCapacity) {
|
||||||
@ -65,7 +65,8 @@ public class MemoryDataStore implements DexDataStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int getNewBufferSize(int currentSize, int newMinSize) {
|
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) {
|
@Nonnull @Override public InputStream readAt(final int offset) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user