I am running a process via scheduled task where a batch file opens up an Excel
session, loads an XLL, calculates a bunch of numbers, saves the values to a
separate file with the date/time stamp, and closes down.
This process
works fine apart from the closing down bit. Though Excel itself is not visible
any longer, an EXCEL.EXE is still running (with a large memory footprint) in the
Task Manager.
The problem is that since this process is repeated on an
hourly basis, the scheduled task encounters memory overflow errors due to the
ghost Excel threads, unless I physically terminate all the ghsot threads every
few hours. This is really inconvenient.
I've researched this a lot, and
it looks like it's not an uncommon problem. So I was thinking that one
workaround could be to log the PIDs of the processes kicked off by the scheduled
task and then run another scheduled task every few hours to go and kill those
PIDs.
Can anyone suggest another technique? If not, could anyone point me
to some sample code as I don't really know how or where to start.
Thank
you.