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/09 00:16:37 UTC

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

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

 ##########
 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()
 
 Review comment:
   because `predExec.outputs` is reused and has same lifecycle as `predExec`

----------------------------------------------------------------
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