I ran across a memory leak when saving a huge number of entities (>10000) which have these 2 fields :
@Unindex
@Serialize(zip = true)
private EnumMultiset eventCounter; //event counter
@Unindex
@Serialize(zip = true)
private EnumMap eventOccurrence; //map to hold which event occurred when
The stacktrace :
Error for /worker-module/task/schedule java.lang.OutOfMemoryError at java.util.zip.Deflater.init(Native Method) at java.util.zip.Deflater.(Deflater.java:180) at java.util.zip.Deflater.(Deflater.java:189) at com.googlecode.objectify.impl.translate.SerializeTranslatorFactory$1.saveValue(SerializeTranslatorFactory.java:70)
My analysis is that the SerializeTranslatorFactory, creates Deflater instance in saveValue() method and does not call end() or alternatively finalize() on it. I took help from this blog. Hence it eventually goes out of memory. Also, since the default deflater is not used, the onClose() of DeflaterOutputStream does not automatically call .end();
public void close() throws IOException {
if (!closed) {
finish();
if (usesDefaultDeflater) //false
def.end();
out.close();
closed = true;
}
}
I ran across a memory leak when saving a huge number of entities (>10000) which have these 2 fields :
@Unindex
@Serialize(zip = true)
private EnumMultiset eventCounter; //event counter
@Unindex
@Serialize(zip = true)
private EnumMap eventOccurrence; //map to hold which event occurred when
The stacktrace :
Error for /worker-module/task/schedule java.lang.OutOfMemoryError at java.util.zip.Deflater.init(Native Method) at java.util.zip.Deflater.(Deflater.java:180) at java.util.zip.Deflater.(Deflater.java:189) at com.googlecode.objectify.impl.translate.SerializeTranslatorFactory$1.saveValue(SerializeTranslatorFactory.java:70)
My analysis is that the SerializeTranslatorFactory, creates Deflater instance in saveValue() method and does not call end() or alternatively finalize() on it. I took help from this blog. Hence it eventually goes out of memory. Also, since the default deflater is not used, the onClose() of DeflaterOutputStream does not automatically call .end();
public void close() throws IOException {
if (!closed) {
finish();
if (usesDefaultDeflater) //false
def.end();
out.close();
closed = true;
}
}
I have also created an issue for this.
I ran across a memory leak when saving a huge number of entities (>10000) which have these 2 fields :
@Unindex
@Serialize(zip = true)
private EnumMultiset<Type> eventCounter; //event counter
@Unindex
@Serialize(zip = true)
private EnumMap<Type, String> eventOccurrence; //map to hold which event occurred when