tealeg / xlsx

Go library for reading and writing XLSX files.
Other
5.81k stars 810 forks source link

oom err #752

Closed 15738519635 closed 1 year ago

15738519635 commented 1 year ago

f, err := xlsx.OpenFile(fPath, xlsx.ValueOnly()) if err != nil { return nil, err } arr, err := f.ToSlice() when xlsx file has large number of merged cells(many merged cell has nothing),it will use up all memory(64G)

in lib.go sheetXML = mergerCellRegexp.ReplaceAllFunc(sheetXML, func(mergeMatch []byte) []byte { if !valueRegexp.Match(mergeMatch) { id := generator.Hex128() mergerMap[id] = mergerCellRegexp.Find(sheetXML) mergeMatch = mergerCellRegexp.ReplaceAll(mergeMatch, []byte(id)) } return mergeMatch }) because you create a long id string to replace and fill to sheetXML

Can you give me some advice?

15738519635 commented 1 year ago

memory.xlsx this is xlsx file

tealeg commented 1 year ago

Ongoing issues like this are one of the reasons this project is no longer maintained (by me, at least). It was never really designed to handle the use cases that people throw at it, and continuously hacking it trying to make it better had limited success.

The obvious answer, in this case, is just to fix the issue. I'm still happy to cut releases from the library if people make PRs they really need.

github-actions[bot] commented 1 year ago

Stale issue message