XL plugin release memory sheet

I’m exporting huge bookkeeping data (2,5M lines and 52 colums) to excel using MBS XL plugin.

I created a workbook. I fill a sheet with maximum 500.000 rows. Save the workbook. Delete the sheet, create a new sheet and fill again with 500.000 rows of data. And save again (with increasing number in filename).

Deleting and clearing the sheet doesn’t clear the memory consumption. Does anybody know if I can force a clearing of the memory somehow (or release of the sheet out of the memory)?

2.5 million rows?

You are sure you have no circular references?
e.g. in MBS XL Plugin the sheet class keeps reference to book class. If you put a reference for the other direction, you have a circle.

Please provide test project.
Maybe modify one of our examples.
For me it seems like all memory get released.

@Christian Schmitz
At the end of the process it is released but then I had 6 to 7 sheets in memory before that…

I made some changes, now I only clear the sheet and refilling it. So a max of one sheet stays in memory (test It tomorrow with big data).

First the code was as follows: I created the worksheet
sheet = book.addSheet(“Mutations”)

after the first file was saved deleted the sheet:
bResult = book.DelSheet(1)

and then create a new sheet
sheet = book.addSheet(“Mutations”)

and this up to 6 to 7 times. Probably I created multiple sheet handles to the book which are released after the entire proces has finished.

Probably it is solved now. Test it tomorrow with bigger datafiles.

Well, if it’s a 64-bit app and needs to have 7 sheets in memory, so be it.
Don’t worry.

My PC can handle though I slowly went to 85% memory consumption. But files can become bigger and not al my customers will have the same amount of memory as mine PC.

why do you delete sheets?

If you start a new file, please delete old book and make a new one.
Otherwise you may carry on formats, fonts and other definitions you don’t need any more.