piiswrong commented on a change in pull request #9025: fix small memory leak of sparse embedding URL: https://github.com/apache/incubator-mxnet/pull/9025#discussion_r156273598
########## File path: src/operator/tensor/indexing_op.cu ########## @@ -91,6 +91,7 @@ void SparseEmbeddingOpForwardRspImpl<gpu>(mshadow::Stream<gpu>* s, Kernel<is_valid_check, gpu>::Launch(s, data_size, is_valid_ptr, data_ptr, min, max); CUDA_CALL(cudaMemcpy(&is_valid, is_valid_ptr, sizeof(int32_t), cudaMemcpyDeviceToHost)); + CUDA_CALL(cudaFree(is_valid_ptr)); Review comment: Can you use ctx.requested for this? Uncached cudaMalloc and free are slow. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services