Home > Net >  C # call XpsDocument XPS document storage and memory how to release?
C # call XpsDocument XPS document storage and memory how to release?

Time:05-10

1, to generate an XPS document 2 m memory, circulation generated 1000, growing only memory to release

2, when memory rose to about 1 g, would be an error of "open file" C: \ WINDOWS \ FONTS \ SIMSUN TTC "I/O error,"

3, online said GC. Collect (); SetProcessWorkingSetSize EmptyWorkingSet are not make

 var xpSfile=the string. Format (" {0}. XPS, Guid. NewGuid (), ToString ()); 
Var paginator=((IDocumentPaginatorSource) preview. The Document). DocumentPaginator;
Using (var xpsDoc=new XpsDocument [xpSfile, FileAccess ReadWrite, CompressionOption. Maximum))
{
Using (var XPP=new XpsPackagingPolicy (xpsDoc))
{
Using (var RSM=new XpsSerializationManager (XPP, false))
{
The RSM. SaveAsXaml (paginator);
Rsm.Com MIT ();
XpsDoc. Close ();
}
}
}
  •  Tags:  
  • C#
  • Related