lupesko commented on a change in pull request #13105: [MXNET-1158] JVM Memory Management Documentation URL: https://github.com/apache/incubator-mxnet/pull/13105#discussion_r234840164
########## File path: scala-package/memory-management.md ########## @@ -0,0 +1,117 @@ +# JVM Memory Management +The Scala and Java binding of Apache MXNet uses native memory(C++ Heap either in RAM or GPU memory) in most of the MXNet Scala objects such as NDArray, Symbol, Executor, KVStore, Data Iterators, etc.,. the Scala classes associated with them act as wrappers, +the operations on these objects are directed to the MXNet C++ backend via JNI for performance , so the bytes are also stored in the native heap for fast access. + +The JVM using the Garbage Collector only manages objects allocated in the JVM Heap and is not aware of the memory footprint of these objects in the native memory, hence allocation/deAllocation of the native memory has to be managed by MXNet Scala. +Allocating native memory is straight forward and is done during the construction of the object by a calling the associated C++ API through JNI, however since JVM languages do not have destructors, De-Allocation of these objects becomes problematic and has to explicitly de-allocated. Review comment: Phrasing suggestions: ```suggestion Allocating native memory is straightforward and is done during the construction of the object by a calling the associated C++ API through JNI. However, since JVM languages do not have destructors, deallocation of these objects needs to be done explicitly. ``` ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
