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/09/04 03:35:14 UTC

[GitHub] iperdomo commented on issue #12447: MXNET-884 - Clojure with-resources macro for Improved Memory Handling

iperdomo commented on issue #12447: MXNET-884 - Clojure with-resources macro for Improved Memory Handling
URL: https://github.com/apache/incubator-mxnet/pull/12447#issuecomment-418231600
 
 
   This is an improvement that looks more _idiomatic_. Our current approach is to remember to call `.dispose` on those `NDArray` objects we create, something like:
   ```clojure
   (let [a (ndarray/ones [3])
         b (ndarray/ones [3])
         result (ndarray/+ a b)]
     (doseq [nd a]
       (.dispose ^NDArray nd))
     (doseq [nd b]
       (.dispose ^NDArray nd))
     result)
   ```
   With some discipline you can remember to do it, however our current main issues are `NDArray` objects created at the Scala API that we can't _reach_ and call `.dispose` on them.
   

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