C#C
C#β€’4mo ago
Anburaj Marikkani

πŸ–₯️ C# WinForms + DTO (with COM Object) β†’ πŸ”Ί Memory Usage Problem

Hi everyone πŸ‘‹ I’m running into a memory issue in my WinForms application.

I have a StudentDTO πŸ‘‰ which contains an Address class πŸ‘‰ that wraps a COM object.

The Grid is bound to a collection of these DTOs.

Data comes from an Object Server (C++ framework) that works like an ORM:

Tracks new/modified data.

On save, it validates and pushes changes to SQL backend.

⚠️ Problem: When I bind DTOs to the Grid, memory usage keeps increasing because each row holds a COM object.

πŸ‘‰ Question: What’s the best way to reduce or optimize memory usage when working with DTOs that wrap COM objects in a C# WinForms app?

πŸ™ Any tips, patterns, or best practices would be super helpful!
Was this page helpful?