Hi there
I’m eventually observing an off-heap memory leak using SameDiff. I’ve checked the heap memory with jvisualvm and it seems to stay consistent on a certain level. Meanwhile, the overall memory consumption of the process is continuously increasing until I finally get a memory exception.
Caused by: java.lang.OutOfMemoryError: Cannot allocate new LongPointer(2): totalBytes = 256, physicalBytes = 61440M
at org.bytedeco.javacpp.LongPointer.<init>(LongPointer.java:88)
at org.bytedeco.javacpp.LongPointer.<init>(LongPointer.java:53)
at org.nd4j.linalg.jcublas.ops.executioner.CudaOpContext.setIArguments(CudaOpContext.java:68)
at org.nd4j.autodiff.samediff.internal.InferenceSession.getAndParameterizeOp(InferenceSession.java:867)
at org.nd4j.autodiff.samediff.internal.InferenceSession.getAndParameterizeOp(InferenceSession.java:60)
at org.nd4j.autodiff.samediff.internal.AbstractSession.output(AbstractSession.java:385)
at org.nd4j.autodiff.samediff.SameDiff.directExecHelper(SameDiff.java:2579)
at org.nd4j.autodiff.samediff.SameDiff.evaluateHelper(SameDiff.java:2163)
at org.nd4j.autodiff.samediff.SameDiff.evaluate(SameDiff.java:2073)
at org.nd4j.autodiff.samediff.config.EvaluationConfig.exec(EvaluationConfig.java:197)
at org.nd4j.autodiff.samediff.SameDiff.evaluate(SameDiff.java:2045)
at ***.learn.shared.nn.evaluation.listener.samediff.SameDiffEvaluationListener.epochEnd(SameDiffEvaluationListener.java:62)
at org.nd4j.autodiff.samediff.SameDiff.fitHelper(SameDiff.java:1757)
at org.nd4j.autodiff.samediff.SameDiff.fit(SameDiff.java:1569)
at org.nd4j.autodiff.samediff.SameDiff.fit(SameDiff.java:1509)
at org.nd4j.autodiff.samediff.config.FitConfig.exec(FitConfig.java:172)
at org.nd4j.autodiff.samediff.SameDiff.fit(SameDiff.java:1524)
at ***
at ***
at ***
at ***
at ***
at java.base/java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:1033)
at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1054)
at ***
... 14 common frames omitted
Caused by: java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes (61440M) > maxPhysicalBytes (61440M)
at org.bytedeco.javacpp.Pointer.deallocator(Pointer.java:700)
at org.bytedeco.javacpp.Pointer.init(Pointer.java:126)
at org.bytedeco.javacpp.LongPointer.allocateArray(Native Method)
at org.bytedeco.javacpp.LongPointer.<init>(LongPointer.java:80)
... 38 common frames omitted
The question of interest would more be, how you normally proceed with such problems? I could imagine, that you quite regularly debug such memory leaks, but since it is proprietary code, I can’t share it very easily.
Additionally, the error actually suggests an OOM on the heap, what firstly leaded me into a (likely) wrong direction. Is this correct or have I misinterpreted the exception?
Thank you for any insights!
Best,
Nino