You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/10 07:14:18 UTC

[GitHub] lupesko commented on a change in pull request #11204: Scala inference memory leak fix

lupesko commented on a change in pull request #11204: Scala inference memory leak fix
URL: https://github.com/apache/incubator-mxnet/pull/11204#discussion_r194247861
 
 

 ##########
 File path: scala-package/core/src/main/scala/org/apache/mxnet/FeedForward.scala
 ##########
 @@ -230,8 +230,11 @@ class FeedForward private(
       val padded = batch.pad
       val realSize = batchSize - padded
       for ((list, nd) <- outputs zip predExec.outputs) {
-        list += nd.slice(0, realSize).copy()
+        val ndSliced = nd.slice(0, realSize)
+        list += ndSliced.copy()
+        ndSliced.dispose()
       }
+      batch.dispose()
 
 Review comment:
   Same comment as above about using try/finally to make sure dispose always happens, even in case of an exception.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services