andrewfayres commented on a change in pull request #14372: Memory fixes.
Resolves #10867, and resolves #14080
URL: https://github.com/apache/incubator-mxnet/pull/14372#discussion_r269790109
##########
File path:
scala-package/core/src/main/scala/org/apache/mxnet/ResourceScope.scala
##########
@@ -160,6 +162,17 @@ object ResourceScope {
}
}
+ private[mxnet] def usingIfScopeExists[A](scope: Option[ResourceScope])(body:
=> A): A = {
+ if (scope == None) {
+ body
+ } else {
+ ResourceScope.addToThreadLocal(scope.get)
Review comment:
Discussed this offline so resolving.
Summary of discussion:
There current implementation of ResourceScope always uses the scope on the
top of the stack as the current scope. So to get around this we are pushing the
supplied scope onto the stack, running the code, then popping the scope off the
stack. The alternative is to redesign ResourceScope so that it keeps track of
it's current scope and it could be set. I'm creating a jira ticket to look into
that possibility.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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