The Execute method in Microsoft.SqlServer.Dts.RunTime.Package class has memory leak after each invokation. This following code demonstrates it.
Output from the program:
Allocated memory after 1 iteration(s) = 476316
Allocated memory after 2 iteration(s) = 546448
Allocated memory after 3 iteration(s) = 555008
Allocated memory after 4 iteration(s) = 563632
Allocated memory after 5 iteration(s) = 572232
Allocated memory after 6 iteration(s) = 580856
Allocated memory after 7 iteration(s) = 589480
Allocated memory after 8 iteration(s) = 598240
Allocated memory after 9 iteration(s) = 606816
Allocated memory after 10 iteration(s) = 615424
Allocated memory after 11 iteration(s) = 624000
Allocated memory after 12 iteration(s) = 632576
Allocated memory after 13 iteration(s) = 641152
Allocated memory after 14 iteration(s) = 649728
Allocated memory after 15 iteration(s) = 658352
Allocated memory after 16 iteration(s) = 666948
Allocated memory after 17 iteration(s) = 675760
Allocated memory after 18 iteration(s) = 684380
Allocated memory after 19 iteration(s) = 693008
Allocated memory after 20 iteration(s) = 701532
//-----------------------------------------------------------------------------
// The Execute method in Microsoft.SqlServer.Dts.RunTime.Package has memory
// leak. This program demonstrates it. The package invoked by this program has
// only a single 'Script Task' that does nothing.
//
// To compile, add referece to Microsoft.SQLServer.ManagedDTS.dll.
//
// csc /r:"C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SQLServer.ManagedDTS.dll" ExecPackage.cs
//
//-----------------------------------------------------------------------------
using
System;using
System.Diagnostics;using
Microsoft.SqlServer.Dts.Runtime;namespace
Misc{
/// <summary>
/// Programmatically executes SSIS package, then displays memeory usage
/// after each execution. The memeory usage goes up after each
/// Package.Execute() call, which indicates memory leak!
/// </summary>
static class ExecPackage
{
static void DisplayUsage()
{
Console.WriteLine(@"Usage: ExecPackage <pkgName>");
Console.WriteLine(@" Package <pkgName> resides in Package Store on localhost under \File System\");
}
static void Main(string[] args)
{
// Parse command line arguments.
if (args.Length != 1)
{
DisplayUsage();
return;
}
string pkgName = @"\File System\" + args[0];
// Programmatically execute the package several times.
Application app = new Application();
for (int i = 1; i <= 20; i++)
{
Package pkg = app.LoadFromDtsServer(pkgName, "localhost", null);
pkg.Execute(); // comment out this line, then allocated memory does not increase
// Process.Start("dtexec.exe", "/dts \"" + pkgName + "\"");
pkg.Dispose();
pkg = null;
// Do garbage collection, then display memory usage
GC.Collect();
Console.WriteLine("Allocated memory after {0} iteration(s) = {1}",
i, GC.GetTotalMemory(true));
}
}
}
}

Execute() in class Microsoft.SqlServer.Dts.RunTime.Package has memory leak
richardghome
We appear to have run into the same issue.... we have a ASP.NET application that invokes and run packages (using Package.Execute)... we have confirmed that memory consistently goes up.
Can anyone please verify/clarify that SP2 has the hotfit for memory leak If SP2 does not contain memory hotfix, is there any hotfix available for download
If the memory hotfix is not yet available, when will it be
Thanks.
MFC
Thornbottle
Can anyone provide any hint on this issue Any idea of if/when Microsoft will have a hotfix for this
I have a simple application that can demonstrate the leaking issue...
IamOsiris
We have noticed that every execution of SSIS package leaks significant amount memory (about 71KB in our pakcages). The amount of memory leaking varies depending on the size and complexity of packages. The leakage can be easily reproduced by repeatedly executing a package using a loop (or an array of packages) inside either a C# console application or a ASP.net application. Here is one of discussion threads .. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=407609&SiteID=1
Can anyone please take a look and make some comments on this We are desperately looking for answers.
Joe_Hellsten
[Microsoft follow-up]
blackwing
Thank you for the detailed posting and your time. I have gathered the information and we will investigate.
tom-
Thanks again,
Drew
singlark
Site Defense
Hello,
We have a production server which runs a nightly batch which is quite memory intensive. The batch contains a start package which is started by SQL Server Agent, and starts other packages using the "Execute Package Task".
The server crashes completely, without logging any error information at all, at random moments during the batch, usually with an interval of a few days. The vendor of the server is investigating the hardware configuration, but we weren't able to find a problem there as of yet.
Can the issue described in this topic have anything to do with the server crashes
Kind regards, Jeroen
sirbill
Thanks again,
Drew
Vertexwahn
tao84
Bin, yes we are able to reproduce the issue and we are reviewing it for inclusion into the next service pack. However at this time there is not real work around other than restarting the appliction that calls the package. Thank you again for your time and patience.
Beaver01
Craig,
Are you able to confirm the issue Is there a fix or workaround
Thanks,
Bin
arpicheck
Has there been any updates with this issue I am currently dealing with the same problem.
Thanks,
Drew