System.Printing Printqueue.AddJob方法在打印文档后消耗内存并且不会释放。 [英] System.Printing Printqueue.AddJob methods consumes memory and doesnt releases once the document is printed.
问题描述
大家好,
我在我的应用程序中使用.net framework 3.5使用System.Printing库。当我使用PrintQueue.AddJob在任何打印机上打印作业时,内存会增加并且不会释放它。仅在应用程序关闭时才会释放内存。
如果我打印的作业超过10个,那么我的应用程序会使用我计算机的所有内存,最后一切都会变慢。
我观察到内存使用量达到2GB,这是不可接受的。
调查后我发现当调用PrintqQueue.AddJob方法时内存会增加。
这是我的打印代码示例:
PrintServer printServer = new PrintServer( @ \\ shindede);
PrintQueue PrintQ = new PrintQueue(printServer, HP_Printer,PrintSystemDesiredAccess.AdministratePrinter);
PrintQ.AddJob( xyz, @ C:\ ProgramData \ MyComapny \PrintSoftware \Config \Print_Manager \INPUT \d7a8a71b-4e73-43ec-8ee9-bbe24b3ba2cb.xps , false );
解决方案已经建议已经发布到您的跨帖问题上了
http://stackoverflow.com/questions/23537009/system-printing-printqueue-addjob-methods-consumes-memory-and-doesnt-releases-on [ ^ ]
Hi All,
I am Using System.Printing library in my application with .net framework 3.5. When i Print job on any printer using PrintQueue.AddJob memory gets increased and doesnt releases it. Memory is released only if the application is closed.
If i print more than 10 jobs then my application uses all the memory of my computer and finally everything gets slows down.
I obeserved the memory usage goes to 2GB, which is not acceptable.
After investigation i found that Memory gets increased when PrintqQueue.AddJob method is invoked.
Here is my sample Code for printing:
PrintServer printServer = new PrintServer(@"\\sshinde");
PrintQueue PrintQ = new PrintQueue(printServer, "HP_Printer", PrintSystemDesiredAccess.AdministratePrinter);
PrintQ.AddJob("xyz", @"C:\ProgramData\MyComapny\PrintSoftware\Config\Print_Manager\INPUT\d7a8a71b-4e73-43ec-8ee9-bbe24b3ba2cb.xps", false);
The solution I would have suggested has already been posted to your cross-post question on SO
http://stackoverflow.com/questions/23537009/system-printing-printqueue-addjob-methods-consumes-memory-and-doesnt-releases-on[^]
这篇关于System.Printing Printqueue.AddJob方法在打印文档后消耗内存并且不会释放。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!