MSDN > 論壇首頁 > XML Paper Specification (XPS) > Increasing memory leak with batch writing
發問發問
 

一般討論Increasing memory leak with batch writing

  • 2009年3月11日 下午 06:15Hmeidi 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hello All,

    I have a problem of increasing memory allocation when I use VisualsToXpsDocument to batch write a large number of pages (1000 pages) with print ticket to Xps document.

    Here is the code that I used:

     

          // use batch writer with ticket

       _ xpsBatchWriter = static_cast<VisualsToXpsDocument __gc*>  (_xpsDocumentWriter ->CreateVisualsCollator());

        _xpsBatchWriter ->BeginBatchWrite();     

    for (int i = 0 ; i < 1000 ; i++)

    {

          ticket = __gc new PrintTicket();

          containerVisual = __gc new ContainerVisual();

          pageMediaSize = __gc new PageMediaSize(sz.Width, sz.Height);

          ticket ->PageMediaSize = pageMediaSize;

          ticket ->PageOrientation =

          (sz.Width > sz.Height)? PageOrientation::Landscape : PageOrientation::Portrait;

          containerVisual ->Children->Add(fixedPage);

          _xpsBatchWriter ->Write(containerVisual , ticket );

    }

            _xpsBatchWriter ->EndBatchWrite();

     

     

    The allocated memory will continue to increase with each page written.

    I don't know if there is some resources should be released or is it a bug at DotNet framework.


    I'll be so thankful if anyone could help me.

     

     

    Regards,

    Hmeidi.


    • 已變更類型Hmeidi 2009年3月12日 上午 06:14
    •  

所有回覆

  • 2009年7月1日 下午 02:33Hmeidi 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    I can hear my echo cuz no one replies!!
  • 2009年7月1日 下午 02:36Hmeidi 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Where are Microsoft guys to defend their toolkit?

    I said that their is a memory leakage bug in DotNet Framework 3.5, am I wrong??
  • 2009年7月9日 下午 12:23Jo0815 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    maybe same problem I've faced in the past... does it get better when you try following:

    a) calling Measure/Arrange/UpdateLayout to the Visual, and/or
    b) call UpdateLayout at least to one/first fixedPage of the FixedDocumentSequence

    maybe it helps!?

    regards,
    Jo