You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.execute program.
2.waiting and observe memory.
3.press mouse left to stop memory increasing.
Expected results
memory is released.
Actual results
memory remain unchanged.
Code sample
Code sample
import'dart:typed_data';
import'dart:ui'as ui;
import'package:flutter/gestures.dart';
import'package:flutter/material.dart';
// The FlutterView into which this example will draw; set in the main method.latefinal ui.FlutterView view;
voidpaintExpensive(ui.Canvas canvas, ui.Rect paintBounds) {
}
voidpaintCheap(ui.Canvas canvas, ui.Rect paintBounds) {
}
ui.Image? lastImage;
bool stop=false;
ui.Picturepaint(ui.Rect paintBounds) {
final ui.PictureRecorder recorder = ui.PictureRecorder();
final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
ui.Picture picture;
if (lastImage ==null) {
paintExpensive(canvas, paintBounds);
picture = recorder.endRecording();
lastImage = picture.toImageSync(paintBounds.width.ceil(), paintBounds.height.ceil());
} else {
canvas.drawImage(lastImage!, ui.Offset.zero, ui.Paint());
paintCheap(canvas, paintBounds);
picture = recorder.endRecording();
if(!stop){
lastImage?.dispose();
lastImage = picture.toImageSync(paintBounds.width.ceil(), paintBounds.height.ceil());
}
}
return picture;
}
ui.Scenecomposite(ui.Picture picture, ui.Rect paintBounds) {
double devicePixelRatio = view.devicePixelRatio;
finalFloat64List deviceTransform =Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] =1.0
..[15] =1.0;
final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
return sceneBuilder.build();
}
Future<void> beginFrame(Duration timeStamp) async {
final ui.Rect paintBounds = ui.Offset.zero & (view.physicalSize / view.devicePixelRatio);
final picture =paint(paintBounds);
final ui.Scene scene =composite(picture, paintBounds);
picture.dispose();
view.render(scene);
ui.PlatformDispatcher.instance.scheduleFrame();
}
voidhandlePointerDataPacket(ui.PointerDataPacket packet) {
var expand =PointerEventConverter.expand(packet.data, (viewId) => view.devicePixelRatio).toList();
if(expand.isEmpty)return;
PointerEvent? lastEvent = expand.last;
if(lastEvent isPointerDownEvent){
if(lastEvent.buttons==kPrimaryMouseButton){
stop=true; //this will prevent memory incresing.
}
}
}
voidmain() {
view = ui.PlatformDispatcher.instance.implicitView!;
// Finally, we register our beginFrame callback and kick off the first frame.
ui.PlatformDispatcher.instance
..onBeginFrame = beginFrame
..onPointerDataPacket = handlePointerDataPacket
..scheduleFrame();
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.19.4, on Microsoft Windows [版本 10.0.19045.4412], locale zh-CN) • Flutter version 3.19.4 on channel stable at D:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 68bfaea224 (8 weeks ago), 2024-03-20 15:36:31 -0700 • Engine revision a5c24f538d • Dart version 3.3.2 • DevTools version 2.31.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn[√] Windows Version (Installed version of Windows is version 10 or higher)[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at D:\Android\Sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = D:\Android\Sdk • Java binary at: D:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) • All Android licenses accepted.[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3) • Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.8.34330.188 • Windows 10 SDK version 10.0.22621.0[√] Android Studio (version 2023.3) • Android Studio at D:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)[√] IntelliJ IDEA Community Edition (version 2024.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.1 • Flutter plugin version 79.1.3 • Dart plugin version 241.15845[√] IntelliJ IDEA Ultimate Edition (version 2022.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2022.3 • Flutter plugin version 72.1.4 • Dart plugin version 223.7571.203[√] VS Code (version 1.76.2) • VS Code at C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.86.0[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19045.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.60 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.105[√] Network resources • All expected network resources are available.• No issues found!
The text was updated successfully, but these errors were encountered:
Steps to reproduce
1.execute program.
2.waiting and observe memory.
3.press mouse left to stop memory increasing.
Expected results
memory is released.
Actual results
memory remain unchanged.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: