Skip to content

OpenGlControlBase.RequestNextFrameRendering has a memory leak in Avalonia 12 #21259

@MeltyPlayer

Description

@MeltyPlayer

Describe the bug

I have a custom OpenGL renderer in Avalonia that I've been using some time, but in Avalonia 12 it now steadily leaks memory. I haven't dug into it extensively, but I've been able to narrow the issue down to calling OpenGlControlBase.RequestNextFrameRendering() to queue up the next frame; the leak happens regardless of whether anything is actually rendered within.

Image

To Reproduce

The following code should be enough to reproduce this issue:

public class OpenTkControl : OpenGlControlBase {
  protected override void OnOpenGlRender(GlInterface gl, int fb) {
    this.RequestNextFrameRendering();

    // (Rendering would happen here, but doesn't need to occur to trigger the leak)
  }
}

Expected behavior

Either that OpenGlControlBase.RequestNextFrameRendering wouldn't leak memory, or that OpenGlControlBase would expose another flow for consistently rendering at some framerate.

Avalonia version

12.0.1

OS

Windows

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions