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_r269789050
##########
File path:
scala-package/core/src/main/scala/org/apache/mxnet/ResourceScope.scala
##########
@@ -179,7 +192,7 @@ object ResourceScope {
* @param r ResourceScope to remove
*/
private[mxnet] def removeFromThreadLocal(r: ResourceScope): Unit = {
- threadLocalScopes.get() -= r
+ threadLocalScopes.get().remove(threadLocalScopes.get().lastIndexOf(r))
Review comment:
We discussed this offline so I'm resolving.
Summary of our discussion:
This is essentially being more explicit but is potentially slower. We don't
expect many ResourceScopes in the queue so the difference should be minimal.
Also, if things work as is assumed by the previous implementation, r will
always be in the last index and will be the first element tried.
----------------------------------------------------------------
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