mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-27 16:10:36 +07:00
Fill obtained arrays with null to allow GC
This commit is contained in:
parent
20b7908efb
commit
41a8f42a33
@ -1,6 +1,7 @@
|
|||||||
package com.riiablo.map2.util;
|
package com.riiablo.map2.util;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.Arrays;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Pool;
|
import com.badlogic.gdx.utils.Pool;
|
||||||
@ -23,6 +24,11 @@ public class ArrayPool<E> extends Pool<E> {
|
|||||||
return new ArrayPool<>(clazz, length, initialCapacity, maxCapacity);
|
return new ArrayPool<>(clazz, length, initialCapacity, maxCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void reset(E object) {
|
||||||
|
if (object instanceof Object[]) Arrays.fill((Object[]) object, null);
|
||||||
|
}
|
||||||
|
|
||||||
final Class<E> clazz;
|
final Class<E> clazz;
|
||||||
final int length;
|
final int length;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user