Bug 22862 - Excel memory error - "The memory could not be written"
Summary: Excel memory error - "The memory could not be written"
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC other
: P3 normal with 2 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-01 16:45 UTC by Ran Leitman
Modified: 2008-05-05 15:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ran Leitman 2003-09-01 16:45:45 UTC
I have a template excel file with few sheets of data and macro. I run the macro 
in excel application and the macro is creating a new empty sheet to the 
workbook, then the POI is running and is writing data to the latter empty sheet 
in the template file. 

After POI was running when trying to open the workbook in excel application 
(excel 2000 - 9.0.3821 SR-1) I got an application error - "The instruction 
at "0x3005c5eb" referenced memory at "0x0000018". The memory could not be 
written", afterwards I have to manually kill the excel process.

I overcome the problem in a weard way , If , after the macro was running , I 
manually delete the empty sheet and create it again and then run POI then every 
thing is o.k.
It seems that the creation of empty sheet via macro is affecting POI later on.
Any Ideas ?
Comment 1 Andy Oliver 2003-09-02 11:51:22 UTC
we need a sheet + easy-to-run program to replicate this.  Excel throws this for nearly ANY 
problem with the xls.  (great piece of software eh ;-))
Comment 2 William Crighton 2003-10-09 22:13:21 UTC
I'm in the middle of a development project using POI as an Excel report 
generator, so I don't have a simple example separated out from my code. 
However, I was able to reproduce this bug by taking a existing spreadsheet file 
with 5 worksheets on it 15 rows x 25 col per (file size = 2M). 

In my code I created an additional worksheet and wrote debug information to the 
new sheet, row by row. For each row I would create a number of new cells, using 
a 'cell counter' to identify where in the row I wanted the new cell to appear.

Instead of resetting my 'cell counter' value each time I created a new row I 
just kept incrementing it, and the resulting spreadsheet would not open.

When I modified my code to reset the 'cell counter' the spreadsheet would open 
fine. The resulting 'cell counter' value in the spreadsheets that would not 
open was 966.

So the bug seems to be related to either a maximum allowable cell number per 
row or a maximum number of empty cells per row.

If there is interest I can try to extract out an example.
Comment 3 Ran Leitman 2003-10-14 07:23:21 UTC
It seems the error occured only when I import new macro code to the template 
(so I know the reason its not so bad), then some old objects exist and the 
error occured , again I overcome it by deleting and creating the sheet each 
time I import new macro code to my template.
Comment 4 Avik Sengupta 2003-10-14 07:28:40 UTC
William, yes, it will be great if you could extract an example. As Andy
explained,  excel throws this kind of an error for *any* sheet corruption issue
(it could be one misplaced byte out of millions!), so without an example sheet,
its quite impossible to figure out what is happening. 
Comment 5 Josh Micich 2008-05-05 15:02:20 UTC
4 years later, POI generally behaves a lot better.  It's likely that whatever caused this specific bug has been fixed.  

This is not to say that POI will never write a file that will crash Excel. In the event that a similar bug re-surfaces, some sample code (or the offending file at least) will be required to diagnose the issue.