microsoft / microsoft/microsoft-ui-xaml
OutOfMemoryException when repeatedly initializing InkCanvas in UWP
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
In UWP, initializing a new instance of `InkCanvas` more than 127 times results in an `OutOfMemoryException` with the message: "Insufficient memory to continue the execution of the program."
Link to public repository (that contains issue reproducible sample): https://github.com/VishalOmprasad/InkCanvas-Issue-UWP.
### Steps to reproduce the bug
1. Create a new UWP project.
2. Add a `Button` control.
3. In the Button.Click event handler, include a `for` loop to repeatedly initialize new instances of `InkCanvas`.
4. Run the app and observe that it crashes with an `OutOfMemoryException` after initializing `InkCanvas` more than 127 times.
### Expected behavior
The app should not crash with `OutOfMemoryException`.
### Screenshots
_No response_
### NuGet package version
None
### Windows version
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Use the linked InkCanvas-Issue-UWP repository to reproduce the failure; start with the Button.Click handler and its loop that creates repeated InkCanvas instances. Done means the sample can initialize InkCanvas more than 127 times without the reported OutOfMemoryException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100