Skip to content

scrollController.jumpTo() at top causes a surge in memory #64124

@Bedroome

Description

@Bedroome
class A extends StatelessWidget {
  ScrollController _scrollController = ScrollController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          _scrollController.jumpTo(0.0);
        },
      ),
      body: CustomScrollView(
        controller: _scrollController,
        slivers: [
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return Image.network(
                  'https://picsum.photos/seed/${Random().nextInt(99999)}/500/500',
                  height: 200,
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}

When my list slides to the back, such as 400 to 500, clicking the button to top will cause the memory to rise suddenly
截屏2020-08-19 上午11 27 12
When I click on the above, a peak appears

[✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G73, locale zh-Hans-CN)
 
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 3.5)
[!] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.48.0)
[✓] Connected device (1 available)

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

f: scrollingViewports, list views, slivers, etc.found in release: 1.20Found to occur in 1.20frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onperf: memoryPerformance issues related to memory

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions