Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

OutofMemory Exception

Last post 09-08-2010, 4:31 AM by Salman Shakeel. 3 replies.
Sort Posts: Previous Next
  •  09-01-2010, 7:47 PM 256690

    OutofMemory Exception .NET

    I am evaluating Aspose.Cells control for .NET and I am facing out of memory issue. Our requirement is to pull around 500,000 records from database (mix of various data types) with about 100 columns and create spreadsheet compatible with Excel 2003 in the process. All data has to be contained in one file and we can't break it up into multiple files. I have been monitoring the process  and at around 350000 rows, memory usage is around 1.7 gigs and system blows up with out of memory exception. We are able to open excel file that contains that amount of data within Excel and our client currently creates it by using VBA code to pull data from MS Access db into Excel. They want to move away from that I was hoping to use your control set. Here is the code that I use to populate worksheets:

                    Workbook wb = new Workbook();
                    wb.Worksheets.Clear();

                    for (int i = 1; i < 500000; i += 65536)
                    {
                        
                        Worksheet ws = wb.Worksheets.Add("Sheet"+i.ToString());
                        Console.WriteLine("Inserting sheet named {0} ", "Sheet" + sheetCount.ToString());
                        Console.WriteLine("Currently added rows - {0}", i);
                        cmd.Parameters.Clear();
                        SqlParameter param = cmd.CreateParameter();
                        param.ParameterName = "@minRow";
                        param.Value = i;
                        param.SqlDbType = SqlDbType.Int;
                        param.Direction = ParameterDirection.Input;
                        cmd.Parameters.Add(param);
                        SqlParameter param1 = cmd.CreateParameter();
                        param1.ParameterName = "@maxRow";
                        param1.Value = i + 65536;
                        param1.SqlDbType = SqlDbType.Int;
                        param1.Direction = ParameterDirection.Input;
                        cmd.Parameters.Add(param1);

                        using (SqlDataReader rd = cmd.ExecuteReader())
                        {
                            Cells cells = ws.Cells;
                            cells.ImportDataReader(rd, true, 0, 0, false);
                        }

                        sheetCount++;
                    }

                    wb.Save(String.Format("c:\\test.xls", sheetCount));

    Do you have any suggestions regarding how I can overcome OutOfMemory exception?
     
  •  09-02-2010, 10:38 AM 256843 in reply to 256690

    Re: OutofMemory Exception

    Hi Mikhail,

    We are looking into this issue. It needs some time to dig down to the root cause of this issue. We will update you as soon as possible.

    Furthermore, please forward us the details of Software & Hardware you are using.

    Thanks,


    Sincere Regards,

    Salman Shakeel
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  09-02-2010, 10:46 AM 256844 in reply to 256843

    Re: OutofMemory Exception

    I am using 32-bit Windows XP SP3. My hardware configuration is Intel Core 2 6300 CPU (1.86 Ghz) and 4 gigs of RAM.
     
  •  09-08-2010, 4:31 AM 257554 in reply to 256844

    Re: OutofMemory Exception

    Hi Mikhail,

    We are working on this issue. In fact we use to initialize cells in memory and then write to disk. Each cell has much information associated with it. In this way each cell cost memory. We are now in process of remodeling this structure so that memory usage can be much more less. It takes time to get fixed and tested. We will update you as soon as possible.

    Thanks,


    Sincere Regards,

    Salman Shakeel
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
View as RSS news feed in XML