Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPossible leak using Win2D inside a PivotItem #522
Comments
|
I'm curious what do you see to make you think this is a leak issue? (your bug title and the repro project name mention a leak, but I don't see in the repro steps where the leak part comes in...) Looking at your repro code, my first guess is maybe your compass change handler is calling Invalidate on the CanvasControl after that CanvasControl has been unloaded? (due to scrolling away from it in the pivot view) Enabling mixed mode (or native) debugging in your Visual Studio project debug settings may give more useful information like a full crash callstack. |
|
Sorry, that is not my real project, it's one I created to test this issue. I am not sure that the problem here is Win2D, but it is what I guessed after a lot of investigating. The possible leak I refer to is that the memory keeps growing when changing to the second pivot item until crash, but it doesn't happen if I do not draw at all or I keep in the first pivot item. I updated the project subscribing to the Loaded and Unloaded event of Canvas control and activating/deactivating the compass in those methods, but it crashes as before. As a note, the Unloaded event is not called when the pivot item changes. A possible fix from my side is to stop manually the invalidates when the Pivot Selected event is fired, but it's weird that the app crashes if I don't. You can test this with an device/emulator with the compass enabled. This is the callstack I managed to get from a dump:
As you can see, sadly, no so much information or at least, I don't understand it. The symbols are being downloaded from Microsoft servers, but it seems it doesn't find them. I hope you can point me in the right direction and I apologize if I didn't explained well at the beginning. Thanks! |
|
I ran your test app and switched back and forth between the two pivots a bunch of times without seeing any crash or memory increase. What else do I need to do to reproduce the problem? |
|
Did you test it with a device with compass enabled? Like a real device or a mobile emulator? If not, the method OnCompassReadingChanged that executes the invalidate is not being called. |
|
I tried in the emulator but did not see any crash. |
|
I don't understand... For me it's a 100% crash ratio when I keep the app in the second pivot item and the OnCompassReadingChanged method is being called. The emulator I am using is "Mobile Emulator 10.0.14393.0 WVGA 4 inch 512MB" and has the compass enabled in its options, although I tested even with the 3GB one and the crash happens, only after a little more time than the 512 version. When executing it with target "Local machine" the crash doesn't happen because my computer it has no compass an that method is not being called, which makes sense. What can be the difference? I will record a video in case you cannot reproduce it to show the crash so you can see I am not inventing things |
|
I also can reproduce it. @shawnhar |
|
I don't know why I'm not seeing the same thing you are. Can you avoid this by not invalidating the control while it is not visible? |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I think I have found an issue related to Win2D. This a sample project to test it.
The steps to reproduce are:
It only happens when you scroll to the second item, until that moment the memory profiling shows good readings. I tried to investigate it, but the fault is in native memory and the symbols don't seem to work. What do you think?
Thanks in advance!
Note: You need to test it with a device with compass.