-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[METAL] Fix memory leaks in Metal runtime (#7714)
* [METAL] Fix memory leaks in Metal runtime 1. In case when we build runtime without ARC, we can have problems with memory releasing. Due to some of Objective-C methods returns autoreleased pointers, we should specify `autoreleasepool` blocks to determine life cycle of these pointers. 2. Added workaround for problem with work group size. Sometimes auto scheduler generates parameters when work group size is more than possible. And in this case we got assert from Metal library. Added check for this situation and it helps to avoid assert. 3. Fixed memory leak problem when fill tensor by random data. DLManagedTensor increases reference counter in NDArray but nobody delete this DLManagedTensor in proper way. This is why memory which was allocated by NDArray was never released. 4. Removed unnecessary retains. It is not necessary use retain in some places where they were used, due to we build metal runtime without ARC. * Use const_cast instead of creation DLManagedTensor
- Loading branch information
Showing
3 changed files
with
189 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.