Skip to content

[Impeller] Simple program on Android Vulkan backend fails to release graphics memory, eventually crashes #131001

@dnfield

Description

@dnfield
import 'dart:math' as math;
import 'dart:ui';

Color randomColor([double opacity = 1.0]) =>
    Color((math.Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(opacity);

void main() async {
  window.onBeginFrame = (_) {
    final recorder = PictureRecorder();
    final canvas = Canvas(recorder);
    canvas.drawPaint(Paint()..color = randomColor());
    canvas.drawRect(
      const Rect.fromLTWH(200, 200, 300, 300),
      Paint()..color = randomColor(.5),
    );
    final picture = recorder.endRecording();
    final builder = SceneBuilder();
    builder.addPicture(Offset.zero, picture);
    final scene = builder.build();
    window.render(scene);
    scene.dispose();
    picture.dispose();

    window.scheduleFrame();
  };
  window.scheduleFrame();
}

Run this on a Pixel 7 pro for a minute or so and eventually:

E/flutter (10821): [ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: Failed to encode and submit command buffer while ending render pass.
E/flutter (10821): [ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: Failed to encode and submit command buffer while ending render pass.

And the app stops rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions