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

Internal objects (SKCanvasView, MotionCanvas, etc) not getting disposed #1725

Open
jo-ruch opened this issue Dec 10, 2024 · 0 comments
Open

Comments

@jo-ruch
Copy link

jo-ruch commented Dec 10, 2024

Describe the bug
Some resources used by the CartasianChart (and possibly others) are not released when the view is no longer being used. The context in which we found this issue is while navigating through content pages. When a page is navigated away from, all its resources should be released and reclaimed by the garbage collector, however not all objects created by the CartasianChart are properly released and stay in memory.

To Reproduce
Steps to reproduce the behavior:

  1. Create a content page with a CartasianChart
  2. Navigate from another page to the page with the chart
  3. Navigate away from the page with the chart to another page

Expected behavior
All objects created by CartasianChart are released and cleaned up by the garbage collector.

Screenshots
Consistent increase in memory footprint after navigating to/from page with chart multiple times
Screenshot 2024-12-10 121942

Note the warnings from the Maui memory toolkit about orphaned objects.
Screenshot 2024-12-10 112933

Memory snapshot after navigating away from page with CartasianChart. Skia and Canvas objects are still present in memory
Screenshot 2024-12-09 143442

Desktop (please complete the following information):

  • OS: Windows 11 (build 26100.2314)
  • Version: 2.0.0-rc4.5
  • .NET: version 8

Additional context
Please see attached project to that illustrates the issue: https://github.com/jo-ruch/LiveCharts2MauiMemoryLeakDemo/tree/main

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

No branches or pull requests

1 participant