Reputation: 13079
I am runnig an SSIS package from C# code like so:
ErrorHandler errorHandler = new ErrorHandler();
Application app = new Application();
DTSExecResult res;
Package pkg = app.LoadPackage(packagePath, null);
res = pkg.Execute(null, null, errorHandler, null, null);
I have two questions:
What "engine" runs this package ? Does SQL Server runs it, or a smaller SSIS engine is the only thing needed.
When this c# code (it's a console application) runs for long periods it eats up more and more memory gradually. How can I limit the memory usage of the package being run ?
*One idea that came to mind that this behavior is like SQL Server behavior i.e. it takes up memory and never releases it, of course under the memory limit defined. So maybe the "engine" that runs the package is set up with a certain memory limit which gradually gets filled.
Upvotes: 1
Views: 1490
Reputation: 1680
That's some reasonable extrapolation - but not accurate.
What I could suggest is that you create your package to limit itself. In my case, with a loop, I could implement a "20 loop maximum", where the package simply finishes after 20 loops, even if there are still files to process. A return value or database table could signal that more processing remained to be done. Inside your C# app, you could loop on the call to pkg.Execute, possibly with some GC attempts in there. I don't know if that would be sufficient to trigger the process to release whatever memory was acquired and/or contiguously re-allocate it, but that's what I'd try.
Upvotes: 3