How to Fix acedao.dll Memory Leaks Using DAO Seek in C#
Question details
The user needs to resolve a memory leak in acedao.dll caused by repeated DAO Seek operations in a C# application.

- Product
- Microsoft Access 365
- Device & OS
- not provided
- Scenario
- Executing repeated Seek operations on a table-type recordset using Microsoft Access DAO in a C# application.
- Observed behavior
- The application leaks memory through acedao.dll, leading to excessive memory consumption.
Ensure you have access to the C# application source code and that your development environment is set up to compile and debug Microsoft.Office.Interop.Access.Dao references.
Explicitly Dispose Unmanaged DAO Objects
Properly close and release unmanaged COM objects to prevent memory leaks during repetitive tasks.
DAO objects are unmanaged resources. When accessed via C#, the .NET Garbage Collector does not automatically release the underlying COM objects immediately. This leads to apparent memory leaks during repetitive tasks like Seek operations.
Locate all database and recordset objects in your C# code that utilize DAO Seek.
Wrap your DAO operations within 'using' statements or 'try-finally' blocks to ensure resources are predictably managed.
Explicitly call the 'Close()' method on recordsets and databases as soon as they are no longer needed in the execution flow.
Use 'System.Runtime.InteropServices.Marshal.ReleaseComObject()' to safely decrement the reference count of the unmanaged DAO COM objects.

Verify Process and Provider Bitness
Ensure the application architecture matches the Access database engine version to rule out environment conflicts.
Looking for a Lightweight Office Alternative?
While specialized database integrations like DAO require specific Microsoft tools, everyday document processing shouldn't be complicated or prone to heavy memory usage. WPS Office offers a free, lightweight, and highly compatible alternative for handling spreadsheets, documents, and presentations.
- 1. Download the installer: Visit the official WPS Office website and download the free installation package.
- 2. Install the software: Run the setup file and follow the on-screen instructions to complete the installation.
- 3. Open existing files: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office documents seamlessly.

Frequently Asked Questions
Why is Seek used instead of standard ADO.NET queries?
Seek is a DAO-specific operation that bypasses the SQL parser and query planner, making it significantly faster for certain index-based database lookups. However, it is not available through standard ADO.NET and requires careful manual memory management.
Can I use OLE DB or ODBC to avoid this memory leak?
Yes, OLE DB or ODBC are excellent alternatives for normal database access and standard queries in .NET. However, if your application relies specifically on the performance benefits of DAO Seek, you must explicitly manage COM object disposal instead of switching technologies.
Why does the leak only appear in C# and not in the original VB6 application?
VB6 utilizes deterministic reference counting, immediately releasing COM objects when they go out of scope. C# uses a non-deterministic garbage collector, meaning unmanaged COM objects like acedao.dll can linger in memory unless they are explicitly released by the developer.




