Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Commented Unassigned: Memory leak using Excel workbook [21994]

$
0
0
Hi,
I'm having an issue with workbooks property in Excel.
What I'm trying to do is a loop on a same Excel application object:
1. open a workbook
2. read some data
3. close the workbook
4. dispose the workbook
5. loop until there is no file left

But I can see in task manager that Excel memory is growing everytime I loop despite the dispose method. Is there a way to handle this (maybe I'm not using it the right way) or is that a bug?
Comments: ** Comment from web user: SebastianDotNet **

You may didnt realize the Workbooks property/proxy from _ExcelApplication. (you call them -on the fly- and didnt dispose them)

I suggest you to use

1)
Dim books As Excel.Workbooks = _ExcelApplication.Workbooks
....
books.Dispose()

or dispose all child proxies from _ExcelApplication instead at the end of foreach loop
2)
_ExcelApplication.DisposeChildInstances()

*let me know this helps
Sebastian


Viewing all articles
Browse latest Browse all 1741

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>