I'm using PrintTickets
to print a large number of WPF objects
and things are printing fine. We do have a situation that has been reported where the program is using a ton of the dllhost.exe
memory and climbs until the machine eventually crashes. I've narrowed it down to creating a PrintTicket
and the printqueue.getprintcapabilitiesasxml()
. Each time these are called it jumps the memory usage of the dllhost.exe
each time by sometimes 3+ MB. Can anyone tell me either how to avoid this if possible or if there is a way to clear it after i know it is being used?
Update: I've created a project with simple this code.
for (int i = 0; i < 100; i++)
{
using (System.Printing.PrintQueue pQueuePrnt =
new LocalPrintServer().GetPrintQueue("HP LaserJet 9050 PCL 5"))
{
using (MemoryStream printerCapXmlStream = pQueuePrnt.GetPrintCapabilitiesAsXml())
{
Console.WriteLine(printerCapXmlStream.Length);
}
}
}
This will result in almost 60 MB in the dllhost.exe
that will never go away.