title: how to avoid high memory consumption in itextsharp
body: <p>Here AddPage() method consuming more memory(In Bytes[]) while creating pdf.And it is not freed up after creating pdf.I tried with freereader() method but not useful.Please suggest how can i free memory or way to consume less memory</p>
  
  <pre><code>Public Sub AddStampedPagesToDocument(ByVal stamperStream As MemoryStream)
      Dim documentReader As PdfReader
  
      If stamperStream IsNot Nothing Then
          mStamper.FormFlattening = True
          mStamper.Close()
          documentReader = New PdfReader(stamperStream.ToArray)
  
          If (mOutputWriter Is Nothing) Then
              mOutputDocument = New Document(documentReader.GetPageSizeWithRotation(1))
              mOutputWriter = New PdfCopy(mOutputDocument, mOutputStream)
              mOutputDocument.Open()
          End If
  
          For pageCount As Integer = 1 To mFormReader.NumberOfPages
              mOutputWriter.AddPage(mOutputWriter.GetImportedPage(documentReader, pageCount))
              mOutputDocumentPageCount += 1
          Next
  
          mStamperStream = stamperStream
          mOutputWriter.FreeReader(documentReader)
      End If
  End Sub
  </code></pre>