Skip to content

NET5.0.9 ListView BackgroundImage GDI object leak #5717

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version]
When a win forms app shows a form with a ListView Control that has its BackgorundImage set it does not release 3 GDI objects each time it is disposed and Garbage collected, this is causing major memeory leaks in our application.

Attached is a sample application to demonstrate the issue.

All I did to re-create this, is the following.

  1. Create a new winforms application

    image
    image

  2. Add a new form so you have a Form1 and a Form2.

    image

  3. Add two buttons on Form1, one to garbage collect, and one to open Form2.

        private void btnGarbageCollect_Click(object sender, EventArgs e)
    	{
    		GC. Collect();
    	}
    
        private void btnOpenFormWithListView_Click(object sender, EventArgs e)
    	{
    		Form2 oForm = new Form2();
            oForm.Show();
    	}
  4. On Form2 add a listview and set a backgroup image from a resource.

    image

  5. Open Task manager with the GDIObjects coulmn enabled, and keep opening and closing from 2 from the app and garbage collecting, you will see a jump of 3 GDI objects each time you open and close the form.

    image


Original Comments

Feedback Bot on 9/8/2021, 09:25 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

Marie Shi [MSFT] solved on 9/8/2021, 05:09 PM, 0 votes:

We moved this issue to a relevant GitHub project. Please comment and track it at this URL: dotnet/core#6667

Metadata

Metadata

Assignees

Labels

🪲 bugProduct bug (most likely)area-controls-ListViewtenet-performanceImprove performance, flag performance regressions across core releases

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions