Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ public String toString()
*/
private boolean enableFastBuild;

private double minResizeRatio = 1;

/**
* 控制构建过程中每次扩容的最小比例,避免频繁扩容导致FGC
* @param minResizeRatio 扩容比例,取值范围建议(1, 2]
*/
public void setMinResizeRatio(double minResizeRatio) {
this.minResizeRatio = minResizeRatio;
}

/**
* 拓展数组
*
Expand All @@ -91,6 +101,8 @@ public String toString()
*/
private int resize(int newSize)
{
newSize = Math.max(newSize, ((Double)(allocSize * minResizeRatio)).intValue());

int[] base2 = new int[newSize];
int[] check2 = new int[newSize];
if (allocSize > 0)
Expand Down