Ticket T936665
Visible to All Users

out of memory error when saving a doc as pdf of more than 1.500pages

created 4 years ago

hi,

i have a big database with customer that we are doing mail merges for thousands of envelopes to be shipped to them.
so i use the document control and the mail merge functions of your library now for years.

but recently our clients grown more and i have notice that when we try to save the doc as PDF export, it crashes with error "out of memory" when the doc has like 1.000pages or 1.500pages or 2.000pages.

with the latest v20.1.7 trial i was testing we noticed a significant improvement now we can save sometimes even 2.000pages but is SOMETIMES! the out of memory error still happens and my application is stuck in 1024,4MB of RAM usage all the time! this looks like a memory leak right?

can you please test exporting again and again 2.000pages in pdf?

regards
John

Show previous comments (2)

    just in case i also turned off the DEP for all apps and left it only for windows services and essentials.

    also can this be another reason that i read here? windows server 2016 enterprise:
    https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/desktop-heap-limitation-out-of-memory

    will try to reproduce with the changes but is not easy cant make permanent changes to this database, andis 22GB to take backup and play arround.

      i made some modifications to allow the app to go crazy and use as much ram as it wants… also disabled DEP…
      but what i noticed is that when i load data to populate my girds or to make the mail merge i was referring above… i use EF 6.4.4. and LINQ

      load everything to local object class of the dbcontext .

      i know is best practice and i do a disposal of the dbContext once i am done and keep making new to load the next batch of records and then binding it to your control with new binding source (local.customer) for example.

      BUT even i dispose, even though i do
      mydvCon = new dbcontext

      then load on local and then bind the data

      the memory usage is keep been increased every time i run those linq queries !

      is like the old records even though i don't see them are stuck somehow in a RAM cache or objects and new are keep added up.
      for example my loading function of customers load the RAM with 500mb… thats ok for 52.000r records and calculations on the fly… but when i run the load again…the app goes to 1gb, then again to 1.5gb and will keep add up ram usage until the O.S tries to clean it.

      probably this is also happening with the export to pdf…

      it should reset to -500 and then load up again not been increased every time around functions.

      have you seen this before. everything I google doesn't seem to solve my issue.

      maybe is related to the pdf export.

        Visual Basic
        Private Sub LoadAllContacts() Me.Cursor = Cursors.WaitCursor Call ResetCritiria() myDB.Dispose() GC.Collect() myDB = New dcrmDBEntities() myDB.Configuration.AutoDetectChangesEnabled = True Me.ContactsBindingSource.DataSource = GetType(Contacts) Dim results = (From items In myDB.Contacts Where items.visible = True And items.login_companyID = Common.LoginCompanyID Order By items.id) results.Load Me.ContactsBindingSource.DataSource = New BindingSource() With {.DataSource = myDB.Contacts.Local.ToBindingList()} Me.Cursor = Cursors.Default GC.Collect() End Sub

        what am i doing wrong? this is driving me crazy here

        Answers

        created 4 years ago (modified 4 years ago)

        i think i found the problem but i really dont understand why this is happening.

        Visual Basic
        Me.ContactsBindingSource.DataSource = New BindingSource() With {.DataSource = myDB.Contacts.Local.ToBindingList()}

        the above line is causing the data to be increased in RAM anytime you load them! why? all devexpress and microsoft documentation tell you to do it like that! since in EF6 you cant directly bind the results to the datasource.

        but if you change it to the following the RAM usage during multi times of run, it goes down again to normal level and behavior

        Visual Basic
        Me.ContactsBindingSource.DataSource = myDB.Contacts.Local.ToBindingList()}

        any ideas would be much appreciated!

        update:
        ok i think i see the missunderstanding.
        all those documentations are doing bindingsource objects in code, so the instance is been killed and recreated anytime you execute the function, but my binding sources are been made on the designer by using the devexpress wizard GUI that makes things way easier and faster, the approach of NEW binding each time will only ADD to the existing datasources of that already existed binding source control.

        thats basic programing 101, but sometimes you dont see the answer infront of you. plus the documentations "assume" the wrong conditions so the examples are failing. what i was not aware is that a bindingsource can have multiply "datasources" in it!? thats what it seems to happen here. still cant find any documentation on that thought to verify what i have experienced.

          Show previous comments (1)

            how do you recommend use the EF sources with your grids?
            also any way to have a progress bar when the mail merge is happening in a richtextcontrol?

            DevExpress Support Team 4 years ago

              We usually avoid discussing multiple questions within the same thread because this makes it difficult to track the entire conversation. Therefore, I moved your new questions to separate threads:

              1. T937229: How to show a progress bar during the mail merge operation.
              2. T937228: How to bind GridControl to an Entity Framework data source.

              They are in our processing queue, and we will answer them shortly.

                thank you

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.