locked
Memory out of bounds exception - Asp.net 2.0 RRS feed

  • Question

  • User890640763 posted
    Hi All, I have an application written in Asp.net 2.0 to generate .pdf forms i have used Asp.net 2.0,sql server 2005 ,Ajax etc.My application creates .pdf forms ,but the error part is that It generates 900 forms at first and then it crashes down stating "Exception : out of memory--" i have coded it in vb.net . i strongly doubt is it a problem with the buffer or something as the we have sufficient memory(hard disc space) to genererate over 1 lakh forms Any help .......????????
    Sunday, June 7, 2009 3:03 AM

Answers

  • User-1179452826 posted

    Memory refers to RAM and there may be a limitation on the amount of RAM your server can use. I'd recommend you create a form, save it to a database or the file system, dispose of resources and then create another form. I'm guessing all your forms are in memory and if each form is 2MB in size, that makes 900 forms come to a whopping 1800MB. Is that much RAM available to a single request?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 7, 2009 5:45 AM
  • User-1179452826 posted

    You can definitely use one object to create the forms - AS LONG AS THE FORMS THA ARE CREATED ARE NOT STORED IN MEMORY. What's happening is that the created forms are remaining in Server RAM and when the limit is reached, you get the exception. We can't tell yo the details of the particular library you're using to create the pdfs, but you need to find out what it puts into RAM or even if it has memory leak issues. If you free the RAM that one form takes up before creating the next one, the problem should go away.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 7, 2009 11:22 PM

All replies

  • User-1179452826 posted

    Memory refers to RAM and there may be a limitation on the amount of RAM your server can use. I'd recommend you create a form, save it to a database or the file system, dispose of resources and then create another form. I'm guessing all your forms are in memory and if each form is 2MB in size, that makes 900 forms come to a whopping 1800MB. Is that much RAM available to a single request?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 7, 2009 5:45 AM
  • User854688209 posted

    You can create 9000 pdf forms instead of 900, provided you close and destroy the object which is creating and holding pdf forms after each pdf creation. Create the object of the class which is creating .pdf form as late as possible and destroy it as soon as .pdf get generated.

    I believe you are not destroying the object after creation of .pdf. Post your code which is creating pdf forms.

    Sunday, June 7, 2009 6:12 AM
  • User890640763 posted
    Dear Mr Sumit and Mr Heartattack(!!!) Thanks , i will try out ur solution ,but before that tell be why it is important to create and destroy objects (that create the form) ,my question to u is why cant all the forms be generated by the same object ??? eg : From createForm = new Form(); for (int i = 0 to Maximum ;i++) { //create form ,where one object is used to create all the forms } This is just my curiosity ??
    Sunday, June 7, 2009 11:03 PM
  • User-1179452826 posted

    You can definitely use one object to create the forms - AS LONG AS THE FORMS THA ARE CREATED ARE NOT STORED IN MEMORY. What's happening is that the created forms are remaining in Server RAM and when the limit is reached, you get the exception. We can't tell yo the details of the particular library you're using to create the pdfs, but you need to find out what it puts into RAM or even if it has memory leak issues. If you free the RAM that one form takes up before creating the next one, the problem should go away.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 7, 2009 11:22 PM
  • User854688209 posted

    HeartAttack has explained your question quite well. If you have still doubt, do post it.

    Monday, June 8, 2009 2:00 AM