I'm using libxls library to read .xls
files in C language. I want to load about 40 excel files.
But, when I exceed 12 files the Function xls_open()
crashes with the following message of windows: "segmentation default"
. When I load just 12 files, it works fine.
Can anyone tell me the maximum number of files in memory that the library supports?
I close each file i open by calling xls_close(). This function seems free all memory, here its code:
#define xls_close xls_close_WB
void xls_close_WB(xlsWorkBook* pWB)
{
OLE2* ole;
verbose ("xls_close");
if(!pWB) return;
// OLE first
ole=pWB->olestr->ole;
ole2_fclose(pWB->olestr);
ole2_close(ole);
// WorkBook
free(pWB->charset);
// Sheets
{
DWORD i;
for(i=0; i<pWB->sheets.count; ++i) {
free(pWB->sheets.sheet[i].name);
}
free(pWB->sheets.sheet);
}
// SST
{
DWORD i;
for(i=0; i<pWB->sst.count; ++i) {
free(pWB->sst.string[i].str);
}
free(pWB->sst.string);
}
// xfs
{
free(pWB->xfs.xf);
}
// fonts
{
DWORD i;
for(i=0; i<pWB->fonts.count; ++i) {
free(pWB->fonts.font[i].name);
}
free(pWB->fonts.font);
}
// formats
{
DWORD i;
for(i=0; i<pWB->formats.count; ++i) {
free(pWB->formats.format[i].value);
}
free(pWB->formats.format);
}
// buffers
if(pWB->summary) free(pWB->summary);
if(pWB->docSummary) free(pWB->docSummary);
// TODO - free other dynamically allocated objects like string table??
free(pWB);
}
libxls
which can be built for both OSX and Linux, which have segmentation faults. – Some programmer dude Sep 4 '15 at 11:40