Garbage collector and excel

  • Thread starter Thread starter dev
  • Start date Start date
D

dev

Hello all,
I would like to open for discussion the following scenario. I have a .Net
2003 app that will run on an application server (Win2k OS) that runs many
other apps of varying technologies (not all Microsoft). My application has
two ways of creating Excel objects on its host server. One by creating a
new workbook, and two , by opening an existing workbook. In development,
I never see the GC destroy any of these Excel objects, (except at app
shutdown) no matter how long the app runs, or how many of these objects the
app creates. I have implemented a timer that will close the app after a
certain period of activity, so this will help. But still, the server could
wind up with hundreds of excel objects allocated at any one time. Based on
this, I have decided to take destruction of these Excel objects upon my .Net
application. I have read many GC articles and most of them recommend to
never call the GC, so I think I am going against the recommended methods
here. Comments?

TIA,
Steve
 
* "dev said:
I would like to open for discussion the following scenario. I have a .Net
2003 app that will run on an application server (Win2k OS) that runs many
other apps of varying technologies (not all Microsoft). My application has
two ways of creating Excel objects on its host server. One by creating a
new workbook, and two , by opening an existing workbook. In development,
I never see the GC destroy any of these Excel objects, (except at app
shutdown) no matter how long the app runs, or how many of these objects the
app creates. I have implemented a timer that will close the app after a
certain period of activity, so this will help. But still, the server could
wind up with hundreds of excel objects allocated at any one time. Based on
this, I have decided to take destruction of these Excel objects upon my .Net
application. I have read many GC articles and most of them recommend to
never call the GC, so I think I am going against the recommended methods
here.

Youz will have to "free" the references to the COM objects "by hand",
for example:

\\\
objExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcel)
///
 
Back
Top