Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[METAL] Fix the rest memory leaks in Metal runtime #8175

Merged
merged 3 commits into from
Jun 4, 2021

Conversation

echuraev
Copy link
Contributor

@echuraev echuraev commented Jun 2, 2021

When we throw exception from autoreleasepool, then the resources won't
be released in proper way. In the documentation we can see that "When
the block is exited with an exception, the pool is not drained.".

Link on the documentation:
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

Implemented a wrapper which handles all exceptions in autoreleasepool
block and throw them after this block.

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

When we throw exception from autoreleasepool, then the resources won't
be released in proper way. In the documentation we can see that "When
the block is exited with an exception, the pool is not drained.".

Link on the documentation:
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

Implemented a wrapper which handles all exceptions in autoreleasepool
block and throw them after this block.
@echuraev echuraev force-pushed the echuraev/fix_metal_runtime_mem_leak branch from 8be3271 to 458be49 Compare June 2, 2021 12:10
Copy link
Contributor

@elvin-n elvin-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tqchen tqchen merged commit c9db3d0 into apache:main Jun 4, 2021
@tqchen
Copy link
Member

tqchen commented Jun 4, 2021

Thank you @echuraev

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 17, 2021
* [METAL] Fix the rest memory leaks in Metal runtime

When we throw exception from autoreleasepool, then the resources won't
be released in proper way. In the documentation we can see that "When
the block is exited with an exception, the pool is not drained.".

Link on the documentation:
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

Implemented a wrapper which handles all exceptions in autoreleasepool
block and throw them after this block.

* Apply comments

* Add documentation comments to wrapper and macro
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 17, 2021
* [METAL] Fix the rest memory leaks in Metal runtime

When we throw exception from autoreleasepool, then the resources won't
be released in proper way. In the documentation we can see that "When
the block is exited with an exception, the pool is not drained.".

Link on the documentation:
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

Implemented a wrapper which handles all exceptions in autoreleasepool
block and throw them after this block.

* Apply comments

* Add documentation comments to wrapper and macro
@echuraev echuraev deleted the echuraev/fix_metal_runtime_mem_leak branch September 24, 2021 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants