syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.44k stars 672 forks source link

SfCartesianChart Memory Leak #1821

Open dlewis2017 opened 4 weeks ago

dlewis2017 commented 4 weeks ago

Bug description

When zooming in on SfCartesianChart graphs with SplineSeries data and roughly 7500 dataSource points, the amount of leaks registered by the leak_tracker (not listed but still can install and use) library I'm using jumps significantly. I believe this is tied to slow performance if one has enough graphs rendered. It's registered as "not disposed" which more information can be found here

Steps to reproduce

  1. Create graph.
  2. Render
  3. Zoom

Code sample

Code sample ```dart return SfCartesianChart( key: UniqueKey(), zoomPanBehavior: ZoomPanBehavior( enablePinching: true, enablePanning: true, enableDoubleTapZooming: true, ), enableAxisAnimation: false, enableSideBySideSeriesPlacement: true, title:ChartTitle( text: 'My Title', textStyle: titleSmallStyle?.copyWith(decoration: TextDecoration.underline), ), primaryXAxis: NumericAxis( minimum: 0, axisBorderType: AxisBorderType.withoutTopAndBottom, borderColor: Colors.black, tickPosition: TickPosition.inside, title: AxisTitle( text: 'X title', textStyle: context.pTextTheme.titleSmall, ), majorTickLines: const MajorTickLines(size: 0), majorGridLines: MajorGridLines(width: 1, color: constants.gray.withOpacity(.3), dashArray: const [2, 4]), ) primaryYAxis: NumericAxis( tickPosition: TickPosition.inside, title: AxisTitle( text: 'Y Axis label', textStyle: titleSmallStyle, ), majorTickLines: const MajorTickLines(size: 0), majorGridLines: MajorGridLines(width: 1, color: Colors.gray, dashArray: const [2, 4]), ) series: [..._buildLineSeries(context)], ... } List_builderLinesSeries(BuildContext context) { final muSpots = List.filled(2500, 1.0); final spline = SplineSeries( animationDuration: 0, color: constants.darkBlue, width: 1, dataSource: muSpots, dataLabelSettings: const DataLabelSettings(isVisible: false), xValueMapper: (MyData data, _) => data.x, yValueMapper: (MyData data, _) => data.y, ), return [ spline, spline, spline]; } ```

Screenshots or Video

Screenshots / Video demonstration The zooming begins when the leaks noted in the bottom jump, prefixed with `flutter: leak_tracker: ...` https://github.com/syncfusion/flutter-widgets/assets/8836029/42d7f441-f551-4d5a-a85a-e88eeea25736

Stack Traces

Stack Traces No stacktrace available. Not an exception.

On which target platforms have you observed this bug?

iOS

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.19.5, on macOS 14.3.1 23D60 darwin-arm64, locale en-US) • Flutter version 3.19.5 on channel stable at /Users/mymac/Source/SDK/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1 • Pub download mirror https://mycompany.jfrog.io/artifactory/api/pub/pub-dev/ [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/mymac/Library/Android/sdk • Platform android-32, build-tools 32.0.0 • Java binary at: /usr/bin/java • Java version Java(TM) SE Runtime Environment (build 19.0.2+7-44) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C65 • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). [✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.86.0 [✓] VS Code (version 1.84.0-insider) • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • MyiPad (mobile) • 00008103-000D123E01C3001E • ios • iOS 17.4.1 21E236 • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.61 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
LokeshPalani commented 3 weeks ago

Hi @dlewis2017,

We have checked the reported issue and tried to replicate it in the SfCartesianChart with version 25.1.41+1 by enabling the ZoomPanBehavior and SplineSeries in the iOS platform. However, we were unable to reproduce it on our end. Please check the attached sample, and if you are still experiencing the issue, we request that you replicate it in the attached sample and provide us with more details regarding the specific scenario in which you are encountering this issue. This will help us to assist you more effectively.

We recommend you use our latest syncfusion_flutter_charts package to the latest version below.

Version: https://pub.dev/packages/syncfusion_flutter_charts/versions/25.1.41+2

Regards, Lokesh P.

bd582562 (1).zip

dlewis2017 commented 5 days ago

Hey @LokeshPalani thanks for the response! I'll give the version attached a try and attempt to replicate it there. I've been busy but hoping to get around to it soon. Thank you