Skip to content

DynamicMenuWidget Memory Leak #15975

@hbbfun

Description

@hbbfun

Bug Description:
There is a memory leak in Theia caused by inconsistent usage of addEventListener and removeEventListener. A listener is added with the third parameter set to true (capture mode), but later removed without the same flag. This mismatch prevents the listener from being properly removed, causing retained references and increasing memory usage over time. The issue is located in the Theia framework itself, specifically in the file:
@theia/core/lib/browser/browser-menu-plugin.ts

Steps to Reproduce:
Right-click anywhere in the Theia interface to open the context menu.

Close the context menu.

Repeat this process multiple times (open and close the right-click menu).

Observe memory usage increasing over time.

Additional Information
Operating System: Windows 10

Theia Version: 1.60.2 (also reproducible in the latest version)

Affected File: @theia/core/lib/browser/browser-menu-plugin.ts

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions