Skip to content

ListView on debug and release get High CPU Memory VS iOS native #20857

Closed

Description

@lichentao

my Question:

Sample ListView Page in Diffrent Environment CPU and Memory very Hight, i Want To Know Why ,And How to solution!

====================================================

  1. Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v0.5.1, on Mac OS X 10.13.4 17E199, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.1)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[!] iOS toolchain - develop for iOS devices (Xcode 9.3)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ! CocoaPods out of date (1.5.0 is recommended).
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup
[✓] Android Studio (version 3.1)
[✓] Connected devices (1 available)
  1. 比对:
    image

  2. UI页面
    image

  3. major Code:

            child: PageView.builder(
                itemCount: widget.entity.length,
                controller: controller,
//                controller: scrollController,
                onPageChanged: onPageChanged,
                itemBuilder: (BuildContext context,  int index){
                  return RefreshIndicator(
                    child: ListView.builder(
                        itemCount: dataList.length + 1,
                        itemBuilder: (context,index){
                          if (index == dataList.length){
                            return _buildProgressIndicator();
                          }else{
                            return _buildRow(dataList[index],selectIndex,size,context);
                          }
                        }
                    ),
                    onRefresh: fetchList,
                  );
                },
              ),

Activity

  1. lichentao commented on Aug 21, 2018

    @lichentao
    Author

    @kangwang1988 Sample ListView Page in Diffrent Environment CPU and Memory very Hight, i Want To Know Why ,And How to solution!

  2. kangwang1988 commented on Aug 21, 2018

    @kangwang1988
    Contributor

    @lichentao
    There are several tips for us to help you figure it out.

    1. Please use english if possible
      2.Post the flutter environment you're using by
    flutter doctor -v
    

    3.If possible, create a project in github, so that we can reproduce your problem.

  3. changed the title [-]ListView on debug and release get Hight CPU Memery VS iOS native[/-] [+]ListView on debug and release get High CPU Memery VS iOS native[/+] on Aug 21, 2018
  4. changed the title [-]ListView on debug and release get High CPU Memery VS iOS native[/-] [+]ListView on debug and release get High CPU Memory VS iOS native[/+] on Aug 21, 2018
  5. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    on Sep 1, 2018
  6. added this to the milestone on Sep 1, 2018
  7. Wanghuayin commented on Sep 22, 2018

    @Wanghuayin

    @lichentao ref #20245

    We don't believe that there should be any difference in probability of crash in the "react-style" model vs the "recycler" model, but we're not sure we fully understand your concern. The allocated memory is released regularly, so there should not be a concern of the memory usage being unbounded.

    if you use the Listbuilder, it'll create and destory the instances when you scrolling that why it get so unstable CPU and Memory

  8. lifenautjoe commented on Jan 23, 2019

    @lifenautjoe

    Uh... At the state of things I'm wondering wether it's fair to say to end-users that Flutter is production ready and have seriously started regretting not going for a PWA.

    A lot of the building blocks of basic apps are either missing, incomplete or unstable. (Performant scrolling, date pickers, selectable text fields, non-crashing video players).

    On release mode, sluggish scrolling even with caching of widgets, wantsKeepAlive , const physics and all tricks I could find to make the thing usable. Still, hugely disappointing.

    img_7152 trim 2019-01-23 00_59_30

  9. James-A-White commented on Mar 18, 2019

    @James-A-White

    (NOTE: I'm posting this here because what people may interpret as a problem with the ListView could actually be due to other issues)

    My Flutter app (debug) consumed nearly 20% of the battery power of my phone in under 10 minutes of use. This will not be acceptable to end users. So, I profiled it and noticed some interesting things with the ListView. The most problematic is a situation where the screen with the ListView continues to refresh continuously even when there is no user interaction. And, to make matters worse, the GPU load is pretty high.

    Eventually, I isolated the problem to the CachedNetworkImage library. Apparently, if you include a standard circular progress indicator as a placeholder to display as the images are loading, this is not getting properly disposed after the image loads. Even though it is not displayed on the screen, it is forcing screen refreshes to occur.

    So, if you are having problems with your ListView performance and you are also embedding widgets such as the CircularProgressIndicator in your ListView rows, you might want to try removing these and seeing if that fixes the problem.

    I'll open an issue in the CachedNetworkImage repo.

    Just for grins, my Flutter doctor output is below.

    Jamess-MacBook-Pro:HarrierCentralMobile-Flutter jameswhite$ flutter doctor -v
    [✓] Flutter (Channel unknown, v1.2.2-pre.1, on Mac OS X 10.13.6 17G5019, locale en-US)
        • Flutter version 1.2.2-pre.1 at /Users/jameswhite/projects/flutter
        • Framework revision e0e8e0e0c6 (13 days ago), 2019-03-05 14:02:11 +0100
        • Engine revision 3757390fa4
        • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /Users/jameswhite/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-28, build-tools 28.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
        • All Android licenses accepted.
    
    [✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 10.1, Build version 10B61
        • ios-deploy 2.0.0
        • CocoaPods version 1.6.0
    
    [✓] Android Studio (version 3.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 33.0.1
        • Dart plugin version 182.5215
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    
    [✓] VS Code (version 1.31.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 2.24.0
    
    [✓] Connected device (1 available)
        • J- Connect • 30040687a2b6bdecce8b39ffef7e8358e06e00bf • ios • iOS 12.1.4
    
    • No issues found!
    
  10. potatoker commented on Mar 22, 2019

    @potatoker

    @lichentao ref #20245

    We don't believe that there should be any difference in probability of crash in the "react-style" model vs the "recycler" model, but we're not sure we fully understand your concern. The allocated memory is released regularly, so there should not be a concern of the memory usage being unbounded.

    if you use the Listbuilder, it'll create and destory the instances when you scrolling that why it get so unstable CPU and Memory

    so, the truth is Flutter listView has no recycler mechanism, memory will definitely be increasing when scrolling the list and the programmer will only depends on dart vm itself to gc? And gc not only fresh the dart vm heap but also the native renderingObject memory, right?

  11. NathanAP commented on Apr 9, 2019

    @NathanAP

    I believe thats it, we will depend on dart vm to make things work... The main problem IMO is that we can't do anything to make the ListView smooth or using less memory.

    In my case I have a screen with a ListView.builder with images that if I open twice in any iOS device the app will just crash. Our team got another situation that ListViews were literally making objects being duplicated in the screen.

    For the second situation we created Lists with Rows and Columns and I believe I'll do it for the first situation, but this is really disappointing.

  12. Kavantix commented on May 8, 2019

    @Kavantix
    Contributor

    I might have run into a similar issue, for me items int the listview kept rebuilding even though they did not need to.
    When I removed the refresh indicator it worked as expected
    @NathanAP could you try removing the refresh indicator and see if the performance increases.

  13. added
    perf: energyPerformance issues related to energy use (power, watts)
    perf: memoryPerformance issues related to memory
    on Mar 6, 2020
  14. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  15. removed this from the milestone on Aug 17, 2020
  16. pedromassangocode commented on Sep 16, 2020

    @pedromassangocode

    Hi @lichentao
    Are you still facing this issue? If yes, please provide your flutter doctor -v, your flutter run --verbose and a minimal complete reproducible code sample?
    Thank you

  17. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on Sep 16, 2020
  18. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 14, 2020
  19. TahaTesser commented on Oct 14, 2020

    @TahaTesser
    Contributor

    Without additional information, we are unfortunately not sure how to resolve this issue.
    We are therefore reluctantly going to close this bug for now.
    Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.

  20. github-actions commented on Aug 11, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  21. locked as resolved and limited conversation to collaborators on Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.in triagePresently being triaged by the triage teamperf: energyPerformance issues related to energy use (power, watts)perf: memoryPerformance issues related to memory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions